diff options
author | Moonchild <moonchild@palemoon.org> | 2022-02-03 17:11:21 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2022-02-03 17:11:21 +0000 |
commit | 097fa969802f76530384926e8ef1f56777be3783 (patch) | |
tree | 8f01134d7c464a164707ce81a47d3a418eef0019 /xpcom | |
parent | 56b8a05db34fabefad74e20876309263066b5bce (diff) | |
download | aura-central-097fa969802f76530384926e8ef1f56777be3783.tar.gz |
Issue %3057 - Part 9: Adjust all callsites for no longer using GetNativePath
Depending on context, various solutions were used.
Diffstat (limited to 'xpcom')
-rw-r--r-- | xpcom/base/nsDumpUtils.cpp | 4 | ||||
-rw-r--r-- | xpcom/build/LateWriteChecks.cpp | 15 | ||||
-rw-r--r-- | xpcom/build/XPCOMInit.cpp | 7 | ||||
-rw-r--r-- | xpcom/components/nsNativeModuleLoader.cpp | 6 | ||||
-rw-r--r-- | xpcom/io/nsLocalFileWin.cpp | 6 |
5 files changed, 29 insertions, 9 deletions
diff --git a/xpcom/base/nsDumpUtils.cpp b/xpcom/base/nsDumpUtils.cpp index 1333fdb63..df71bde10 100644 --- a/xpcom/base/nsDumpUtils.cpp +++ b/xpcom/base/nsDumpUtils.cpp @@ -324,7 +324,11 @@ FifoWatcher::OpenFd() } nsAutoCString path; +#ifdef XP_WIN + rv = file->GetPersistentDescriptor(path); +#else rv = file->GetNativePath(path); +#endif if (NS_WARN_IF(NS_FAILED(rv))) { return -1; } diff --git a/xpcom/build/LateWriteChecks.cpp b/xpcom/build/LateWriteChecks.cpp index 7ace9a0fb..218454c4d 100644 --- a/xpcom/build/LateWriteChecks.cpp +++ b/xpcom/build/LateWriteChecks.cpp @@ -122,10 +122,17 @@ InitLateWriteChecks() nsCOMPtr<nsIFile> mozFile; NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(mozFile)); if (mozFile) { - nsAutoCString nativePath; - nsresult rv = mozFile->GetNativePath(nativePath); - if (NS_SUCCEEDED(rv) && nativePath.get()) { - sLateWriteObserver = new LateWriteObserver(nativePath.get()); + nsAutoCString writeObserverPath; +#ifdef XP_WIN + nsAutoString U16Path; + nsresult rv = mozFile->GetPath(U16Path); + CopyUTF16toUTF8(U16Path, writeObserverPath); +#else + // On non-Windows just get the native path. + nsresult rv = mozFile->GetNativePath(writeObserverPath); +#endif + if (NS_SUCCEEDED(rv) && writeObserverPath.get()) { + sLateWriteObserver = new LateWriteObserver(writeObserverPath.get()); } } } diff --git a/xpcom/build/XPCOMInit.cpp b/xpcom/build/XPCOMInit.cpp index ce12e326e..9d1dfd6c5 100644 --- a/xpcom/build/XPCOMInit.cpp +++ b/xpcom/build/XPCOMInit.cpp @@ -680,10 +680,13 @@ NS_InitXPCOM2(nsIServiceManager** aResult, getter_AddRefs(greDir)); MOZ_ASSERT(greDir); nsAutoCString nativeGREPath; +#ifdef XP_WIN + greDir->GetPersistentDescriptor(nativeGREPath); +#else greDir->GetNativePath(nativeGREPath); - u_setDataDirectory(nativeGREPath.get()); #endif - + u_setDataDirectory(nativeGREPath.get()); +#endif // MOZ_ICU_DATA_ARCHIVE // Initialize the JS engine. const char* jsInitFailureReason = JS_InitWithFailureDiagnostic(); if (jsInitFailureReason) { diff --git a/xpcom/components/nsNativeModuleLoader.cpp b/xpcom/components/nsNativeModuleLoader.cpp index 95b8349f1..9be25e2ce 100644 --- a/xpcom/components/nsNativeModuleLoader.cpp +++ b/xpcom/components/nsNativeModuleLoader.cpp @@ -100,7 +100,13 @@ nsNativeModuleLoader::LoadModule(FileLocation& aFile) } nsAutoCString filePath; +#ifdef XP_WIN + nsAutoString filePathW; + file->GetPath(filePathW); + CopyUTF16toUTF8(filePathW, filePath); +#else file->GetNativePath(filePath); +#endif NativeLoadData data; diff --git a/xpcom/io/nsLocalFileWin.cpp b/xpcom/io/nsLocalFileWin.cpp index 2ff05666b..0b4c58ec6 100644 --- a/xpcom/io/nsLocalFileWin.cpp +++ b/xpcom/io/nsLocalFileWin.cpp @@ -3564,7 +3564,7 @@ nsLocalFile::SetNativeLeafName(const nsACString& aLeafName) NS_IMETHODIMP nsLocalFile::GetNativePath(nsACString& aResult) { - //NS_WARNING("This API is lossy. Use GetPath !"); + NS_WARNING("The GetNativePath API is lossy. Use GetPath!"); nsAutoString tmp; nsresult rv = GetPath(tmp); if (NS_SUCCEEDED(rv)) { @@ -3578,7 +3578,7 @@ nsLocalFile::GetNativePath(nsACString& aResult) NS_IMETHODIMP nsLocalFile::GetNativeCanonicalPath(nsACString& aResult) { - NS_WARNING("This method is lossy. Use GetCanonicalPath !"); + NS_WARNING("This method is lossy. Use GetCanonicalPath!"); EnsureShortPath(); NS_CopyUnicodeToNative(mShortWorkingPath, aResult); return NS_OK; @@ -3646,7 +3646,7 @@ nsLocalFile::GetNativeTarget(nsACString& aResult) // Check we are correctly initialized. CHECK_mWorkingPath(); - NS_WARNING("This API is lossy. Use GetTarget !"); + NS_WARNING("This API is lossy. Use GetTarget!"); nsAutoString tmp; nsresult rv = GetTarget(tmp); if (NS_SUCCEEDED(rv)) { |