Changeset 102315 in vbox
- Timestamp:
- Nov 27, 2023 1:24:58 PM (16 months ago)
- svn:sync-xref-src-repo-rev:
- 160449
- Location:
- trunk/src/libs/xpcom18a4
- Files:
-
- 3 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/Config.kmk
r102307 r102315 109 109 TEMPLATE_XPComDll_DEFS.darwin = XP_UNIX=1 XP_MACOSX=1 TARGET_CARBON=1 HAVE_VISIBILITY_ATTRIBUTE=1 $(TEMPLATE_VBoxR3DllNonPedantic_DEFS.darwin) 110 110 endif 111 TEMPLATE_XPComDll_DEFS.darwin.amd64 = VBOX_MACOSX_FOLLOWS_UNIX_IO112 TEMPLATE_XPComDll_DEFS.darwin.arm64 = VBOX_MACOSX_FOLLOWS_UNIX_IO113 111 ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING 114 112 TEMPLATE_XPComDll_DEFS.freebsd = XP_UNIX=1 HAVE_VISIBILITY_ATTRIBUTE=1 -
trunk/src/libs/xpcom18a4/Makefile.kmk
r102314 r102315 243 243 xpcom/io/nsLocalFile.h \ 244 244 xpcom/io/nsLocalFileUnix.h \ 245 xpcom/io/nsLocalFileOSX.h \246 245 xpcom/components/nsModule.h \ 247 246 xpcom/io/nsNativeCharsetUtils.h \ … … 463 462 xpcom/ds/nsArray.cpp \ 464 463 xpcom/ds/nsArrayEnumerator.cpp 465 # xpcom/ds/nsHashPropertyBag.cpp466 464 $(evalcall VBOX_XPCOM_X86,VBox-xpcom-ds) 467 465 -
trunk/src/libs/xpcom18a4/xpcom/io/nsAppFileLocationProvider.cpp
r101962 r102315 48 48 #include "nsCRT.h" 49 49 50 #if (defined(XP_MAC) || defined(XP_MACOSX)) && !defined(VBOX_MACOSX_FOLLOWS_UNIX_IO) 51 #include <Folders.h> 52 #include <Script.h> 53 #include <Processes.h> 54 #include <Gestalt.h> 55 #include "nsILocalFileMac.h" 56 #elif defined(XP_OS2) 57 #define INCL_DOSPROCESS 58 #define INCL_DOSMODULEMGR 59 #include <os2.h> 60 #elif defined(XP_WIN) 61 #include <windows.h> 62 #include <shlobj.h> 63 #elif defined(XP_UNIX) 50 #if defined(XP_UNIX) 64 51 #include <unistd.h> 65 52 #include <stdlib.h> 66 53 #include <sys/param.h> 67 #elif defined(XP_BEOS) 68 #include <sys/param.h> 69 #include <kernel/image.h> 70 #include <storage/FindDirectory.h> 54 #else 55 # error "Not implemented" 71 56 #endif 72 57 … … 148 133 *persistant = PR_TRUE; 149 134 150 #if (defined (XP_MAC) || defined(XP_MACOSX)) && !defined(VBOX_MACOSX_FOLLOWS_UNIX_IO)151 short foundVRefNum;152 SInt32 foundDirID;153 FSSpec fileSpec;154 nsCOMPtr<nsILocalFileMac> macFile;155 #endif156 157 135 if (nsCRT::strcmp(prop, NS_APP_APPLICATION_REGISTRY_DIR) == 0) 158 136 { … … 212 190 rv = localFile->AppendRelativeNativePath(PLUGINS_DIR_NAME); 213 191 } 214 #if (defined(XP_MAC) || defined(XP_MACOSX)) && !defined(VBOX_MACOSX_FOLLOWS_UNIX_IO)215 else if (nsCRT::strcmp(prop, NS_MACOSX_USER_PLUGIN_DIR) == 0)216 {217 if (!(::FindFolder(kUserDomain,218 kInternetPlugInFolderType,219 kDontCreateFolder, &foundVRefNum, &foundDirID)) &&220 !(::FSMakeFSSpec(foundVRefNum, foundDirID, "\p", &fileSpec))) {221 rv = NS_NewLocalFileWithFSSpec(&fileSpec, PR_TRUE, getter_AddRefs(macFile));222 if (NS_SUCCEEDED(rv))223 localFile = macFile;224 }225 }226 else if (nsCRT::strcmp(prop, NS_MACOSX_LOCAL_PLUGIN_DIR) == 0)227 {228 if (!(::FindFolder(kLocalDomain,229 kInternetPlugInFolderType,230 kDontCreateFolder, &foundVRefNum, &foundDirID)) &&231 !(::FSMakeFSSpec(foundVRefNum, foundDirID, "\p", &fileSpec))) {232 rv = NS_NewLocalFileWithFSSpec(&fileSpec, PR_TRUE, getter_AddRefs(macFile));233 if (NS_SUCCEEDED(rv))234 localFile = macFile;235 }236 }237 else if (nsCRT::strcmp(prop, NS_MAC_CLASSIC_PLUGIN_DIR) == 0)238 {239 if (!(::FindFolder(kOnAppropriateDisk,240 kInternetPlugInFolderType,241 kDontCreateFolder, &foundVRefNum, &foundDirID)) &&242 !(::FSMakeFSSpec(foundVRefNum, foundDirID, "\p", &fileSpec))) {243 rv = NS_NewLocalFileWithFSSpec(&fileSpec, PR_TRUE, getter_AddRefs(macFile));244 if (NS_SUCCEEDED(rv))245 localFile = macFile;246 }247 }248 #else249 192 else if (nsCRT::strcmp(prop, NS_ENV_PLUGINS_DIR) == 0) 250 193 { … … 261 204 rv = localFile->AppendRelativeNativePath(PLUGINS_DIR_NAME); 262 205 } 263 #endif264 206 else if (nsCRT::strcmp(prop, NS_APP_SEARCH_DIR) == 0) 265 207 { … … 273 215 // with their own cleanup dir. See bugzilla bug #105087 274 216 rv = CloneMozBinDirectory(getter_AddRefs(localFile)); 275 #ifdef XP_MAC276 if (NS_SUCCEEDED(rv))277 rv = localFile->AppendNative(ESSENTIAL_FILES);278 #endif279 280 217 } 281 218 … … 340 277 nsCOMPtr<nsILocalFile> localDir; 341 278 342 #if defined(XP_MAC) 343 nsCOMPtr<nsIProperties> directoryService = 344 do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv); 345 if (NS_FAILED(rv)) return rv; 346 OSErr err; 347 long response; 348 err = ::Gestalt(gestaltSystemVersion, &response); 349 const char *prop = (!err && response >= 0x00001000) ? NS_MAC_USER_LIB_DIR : NS_MAC_DOCUMENTS_DIR; 350 rv = directoryService->Get(prop, NS_GET_IID(nsILocalFile), getter_AddRefs(localDir)); 351 if (NS_FAILED(rv)) return rv; 352 #elif defined(XP_MACOSX) && !defined(VBOX_MACOSX_FOLLOWS_UNIX_IO) 353 FSRef fsRef; 354 OSErr err = ::FSFindFolder(kUserDomain, kDomainLibraryFolderType, kCreateFolder, &fsRef); 355 if (err) return NS_ERROR_FAILURE; 356 NS_NewLocalFile(EmptyString(), PR_TRUE, getter_AddRefs(localDir)); 357 if (!localDir) return NS_ERROR_FAILURE; 358 nsCOMPtr<nsILocalFileMac> localDirMac(do_QueryInterface(localDir)); 359 rv = localDirMac->InitWithFSRef(&fsRef); 360 if (NS_FAILED(rv)) return rv; 361 #elif defined(XP_OS2) 362 nsCOMPtr<nsIProperties> directoryService = 363 do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv); 364 if (NS_FAILED(rv)) return rv; 365 rv = directoryService->Get(NS_OS2_HOME_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(localDir)); 366 if (NS_FAILED(rv)) return rv; 367 #elif defined(XP_WIN) 368 nsCOMPtr<nsIProperties> directoryService = 369 do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv); 370 if (NS_FAILED(rv)) return rv; 371 rv = directoryService->Get(NS_WIN_APPDATA_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(localDir)); 372 if (NS_SUCCEEDED(rv)) 373 rv = localDir->Exists(&exists); 374 if (NS_FAILED(rv) || !exists) 375 { 376 // On some Win95 machines, NS_WIN_APPDATA_DIR does not exist - revert to NS_WIN_WINDOWS_DIR 377 localDir = nsnull; 378 rv = directoryService->Get(NS_WIN_WINDOWS_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(localDir)); 379 } 380 if (NS_FAILED(rv)) return rv; 381 #elif defined(XP_UNIX) 279 #if defined(XP_UNIX) 382 280 rv = NS_NewNativeLocalFile(nsDependentCString(RTEnvGet("HOME")), PR_TRUE, getter_AddRefs(localDir)); 383 if (NS_FAILED(rv)) return rv;384 #elif defined(XP_BEOS)385 char path[MAXPATHLEN];386 find_directory(B_USER_SETTINGS_DIRECTORY, 0, 0, path, MAXPATHLEN);387 // Need enough space to add the trailing backslash388 int len = strlen(path);389 if (len > MAXPATHLEN-2)390 return NS_ERROR_FAILURE;391 path[len] = '/';392 path[len+1] = '\0';393 rv = NS_NewNativeLocalFile(nsDependentCString(path), PR_TRUE, getter_AddRefs(localDir));394 281 if (NS_FAILED(rv)) return rv; 395 282 #else … … 581 468 if (!nsCRT::strcmp(prop, NS_APP_PLUGINS_DIR_LIST)) 582 469 { 583 #if (defined(XP_MAC) || defined(XP_MACOSX)) && !defined(VBOX_MACOSX_FOLLOWS_UNIX_IO)584 static const char* osXKeys[] = { NS_APP_PLUGINS_DIR, NS_MACOSX_USER_PLUGIN_DIR, NS_MACOSX_LOCAL_PLUGIN_DIR, nsnull };585 static const char* os9Keys[] = { NS_APP_PLUGINS_DIR, NS_MAC_CLASSIC_PLUGIN_DIR, nsnull };586 static const char** keys;587 588 if (!keys) {589 OSErr err;590 SInt32 response;591 err = ::Gestalt(gestaltSystemVersion, &response);592 keys = (!err && response >= 0x00001000) ? osXKeys : os9Keys;593 }594 595 *_retval = new nsAppDirectoryEnumerator(this, keys);596 #else597 470 static const char* keys[] = { nsnull, NS_APP_PLUGINS_DIR, nsnull }; 598 471 if (!keys[0] && !(keys[0] = RTEnvGet("VBOX_XPCOM_PLUGIN_PATH"))) { … … 601 474 } 602 475 *_retval = new nsPathsDirectoryEnumerator(this, keys); 603 #endif 476 604 477 NS_IF_ADDREF(*_retval); 605 478 rv = *_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY; -
trunk/src/libs/xpcom18a4/xpcom/io/nsLocalFile.h
r102195 r102315 72 72 #include "nsILocalFile.h" 73 73 74 #if defined(XP_MACOSX) && !defined(VBOX_MACOSX_FOLLOWS_UNIX_IO) 75 #include "nsLocalFileOSX.h" 76 #elif defined(XP_UNIX) || defined(XP_BEOS) 74 #if defined(XP_UNIX) || defined(XP_BEOS) 77 75 #include "nsLocalFileUnix.h" 78 76 #else -
trunk/src/libs/xpcom18a4/xpcom/io/nsLocalFileCommon.cpp
r16402 r102315 62 62 } 63 63 64 #if (!defined(XP_MAC) && !defined(XP_MACOSX)) || defined(VBOX_MACOSX_FOLLOWS_UNIX_IO)65 64 NS_IMETHODIMP 66 65 nsLocalFile::InitWithFile(nsILocalFile *aFile) … … 74 73 return InitWithNativePath(path); 75 74 } 76 #endif 77 78 #if defined(XP_MAC) 79 #define kMaxFilenameLength 31 80 #else 75 81 76 #define kMaxFilenameLength 255 82 #endif83 77 84 78 NS_IMETHODIMP … … 128 122 } 129 123 130 #if defined(XP_MAC) 131 static const PRUnichar kPathSeparatorChar = ':'; 132 #elif defined(XP_WIN) || defined(XP_OS2) 133 static const PRUnichar kPathSeparatorChar = '\\'; 134 #elif defined(XP_UNIX) || defined(XP_BEOS) 124 #if defined(XP_UNIX) 135 125 static const PRUnichar kPathSeparatorChar = '/'; 136 126 #else 137 127 #error Need to define file path separator for your platform 138 #endif139 140 #if defined(XP_MAC)141 static const char kSlashStr[] = "/";142 static const char kESCSlashStr[] = "%2F";143 128 #endif 144 129 … … 201 186 202 187 for (nodeIndex = 0; nodeIndex < thisNodeCnt && nodeIndex < fromNodeCnt; ++nodeIndex) { 203 #ifdef XP_WIN204 if (_wcsicmp(thisNodes[nodeIndex], fromNodes[nodeIndex]))205 break;206 #else207 188 if (nsCRT::strcmp(thisNodes[nodeIndex], fromNodes[nodeIndex])) 208 189 break; 209 #endif210 190 } 211 191 … … 215 195 for (nodeIndex = branchIndex; nodeIndex < thisNodeCnt; nodeIndex++) { 216 196 NS_ConvertUCS2toUTF8 nodeStr(thisNodes[nodeIndex]); 217 #ifdef XP_MAC218 nodeStr.ReplaceSubstring(kSlashStr, kESCSlashStr);219 #endif220 197 _retval.Append(nodeStr); 221 198 if (nodeIndex + 1 < thisNodeCnt) … … 262 239 while (nodeEnd != strEnd) { 263 240 FindCharInReadable('/', nodeEnd, strEnd); 264 #ifdef XP_MAC265 nsCAutoString nodeString(Substring(nodeBegin, nodeEnd));266 nodeString.ReplaceSubstring(kESCSlashStr, kSlashStr);267 targetFile->Append(NS_ConvertUTF8toUCS2(nodeString));268 #else269 241 targetFile->Append(NS_ConvertUTF8toUCS2(Substring(nodeBegin, nodeEnd))); 270 #endif271 242 if (nodeEnd != strEnd) // If there's more left in the string, inc over the '/' nodeEnd is on. 272 243 ++nodeEnd;
Note:
See TracChangeset
for help on using the changeset viewer.