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 | |
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.
39 files changed, 196 insertions, 33 deletions
diff --git a/components/commandlines/nsCommandLine.cpp b/components/commandlines/nsCommandLine.cpp index 4f6257bef..07eccfc80 100644 --- a/components/commandlines/nsCommandLine.cpp +++ b/components/commandlines/nsCommandLine.cpp @@ -266,7 +266,11 @@ nsCommandLine::ResolveFile(const nsAString& aArgument, nsIFile* *aResult) NS_CopyUnicodeToNative(aArgument, nativeArg); nsAutoCString newpath; +#ifdef XP_WIN + mWorkingDir->GetPersistentDescriptor(newpath); +#else mWorkingDir->GetNativePath(newpath); +#endif newpath.Append('/'); newpath.Append(nativeArg); diff --git a/components/profile/src/nsProfileLock.cpp b/components/profile/src/nsProfileLock.cpp index 654fbcd46..5b6fbe0dc 100644 --- a/components/profile/src/nsProfileLock.cpp +++ b/components/profile/src/nsProfileLock.cpp @@ -192,7 +192,11 @@ nsresult nsProfileLock::LockWithFcntl(nsIFile *aLockFile) nsresult rv = NS_OK; nsAutoCString lockFilePath; +#ifdef XP_WIN + rv = aLockFile->GetPersistentDescriptor(lockFilePath); +#else rv = aLockFile->GetNativePath(lockFilePath); +#endif if (NS_FAILED(rv)) { NS_ERROR("Could not get native path"); return rv; @@ -298,7 +302,11 @@ nsresult nsProfileLock::LockWithSymlink(nsIFile *aLockFile, bool aHaveFcntlLock) { nsresult rv; nsAutoCString lockFilePath; +#ifdef XP_WIN + rv = aLockFile->GetPersistentDescriptor(lockFilePath); +#else rv = aLockFile->GetNativePath(lockFilePath); +#endif if (NS_FAILED(rv)) { NS_ERROR("Could not get native path"); return rv; diff --git a/components/rdf/src/nsFileSystemDataSource.cpp b/components/rdf/src/nsFileSystemDataSource.cpp index 35632d1a3..c67656cd9 100644 --- a/components/rdf/src/nsFileSystemDataSource.cpp +++ b/components/rdf/src/nsFileSystemDataSource.cpp @@ -186,7 +186,7 @@ FileSystemDataSource::Init() NS_NewFileURI(getter_AddRefs(furi), file); NS_ENSURE_TRUE(furi, NS_ERROR_FAILURE); - file->GetNativePath(ieFavoritesDir); + file->GetPersistentDescriptor(ieFavoritesDir); } #endif diff --git a/components/registry/src/nsChromeProtocolHandler.cpp b/components/registry/src/nsChromeProtocolHandler.cpp index f66c6d362..58a8cb7e3 100644 --- a/components/registry/src/nsChromeProtocolHandler.cpp +++ b/components/registry/src/nsChromeProtocolHandler.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* vim:set ts=4 sw=4 sts=4 et cin: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ @@ -160,7 +159,7 @@ nsChromeProtocolHandler::NewChannel2(nsIURI* aURI, file->Exists(&exists); if (!exists) { nsAutoCString path; - file->GetNativePath(path); + file->GetPersistentDescriptor(path); printf("Chrome file doesn't exist: %s\n", path.get()); } } diff --git a/dom/plugins/base/nsPluginHost.cpp b/dom/plugins/base/nsPluginHost.cpp index b36bf9633..a7363de43 100644 --- a/dom/plugins/base/nsPluginHost.cpp +++ b/dom/plugins/base/nsPluginHost.cpp @@ -2022,10 +2022,14 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir, #ifdef PLUGIN_LOGGING nsAutoCString dirPath; +#ifdef XP_WIN + pluginsDir->GetPersistentDescriptor(dirPath); +#else pluginsDir->GetNativePath(dirPath); +#endif PLUGIN_LOG(PLUGIN_LOG_BASIC, ("nsPluginHost::ScanPluginsDirectory dir=%s\n", dirPath.get())); -#endif +#endif // PLUGIN_LOGGING nsCOMPtr<nsISimpleEnumerator> iter; rv = pluginsDir->GetDirectoryEntries(getter_AddRefs(iter)); @@ -3600,7 +3604,11 @@ nsPluginHost::CreateTempFileToPost(const char *aPostDataURL, nsIFile **aTmpFile) } rv = inFile->GetFileSize(&fileSize); if (NS_FAILED(rv)) return rv; +#ifdef XP_WIN + rv = inFile->GetPersistentDescriptor(filename); +#else rv = inFile->GetNativePath(filename); +#endif if (NS_FAILED(rv)) return rv; if (fileSize != 0) { diff --git a/dom/plugins/base/nsPluginStreamListenerPeer.cpp b/dom/plugins/base/nsPluginStreamListenerPeer.cpp index 603f2408c..7ee5cd7fb 100644 --- a/dom/plugins/base/nsPluginStreamListenerPeer.cpp +++ b/dom/plugins/base/nsPluginStreamListenerPeer.cpp @@ -1265,7 +1265,11 @@ nsPluginStreamListenerPeer::OnFileAvailable(nsIFile* aFile) return NS_ERROR_FAILURE; nsAutoCString path; +#ifdef XP_WIN + rv = aFile->GetPersistentDescriptor(path); +#else rv = aFile->GetNativePath(path); +#endif if (NS_FAILED(rv)) return rv; if (path.IsEmpty()) { diff --git a/dom/plugins/base/nsPluginsDirWin.cpp b/dom/plugins/base/nsPluginsDirWin.cpp index 8c2d26ca2..5a2d85f29 100644 --- a/dom/plugins/base/nsPluginsDirWin.cpp +++ b/dom/plugins/base/nsPluginsDirWin.cpp @@ -239,7 +239,7 @@ static bool CanLoadPlugin(char16ptr_t aBinaryPath) bool nsPluginsDir::IsPluginFile(nsIFile* file) { nsAutoCString path; - if (NS_FAILED(file->GetNativePath(path))) + if (NS_FAILED(file->GetPersistentDescriptor(path))) return false; const char *cPath = path.get(); diff --git a/dom/xul/nsXULPrototypeCache.cpp b/dom/xul/nsXULPrototypeCache.cpp index 5644405f5..8f08ae544 100644 --- a/dom/xul/nsXULPrototypeCache.cpp +++ b/dom/xul/nsXULPrototypeCache.cpp @@ -466,7 +466,11 @@ nsXULPrototypeCache::BeginCaching(nsIURI* aURI) if (NS_FAILED(rv)) return rv; nsAutoCString chromePath; +#ifdef XP_WIN + rv = chromeDir->GetPersistentDescriptor(chromePath); +#else rv = chromeDir->GetNativePath(chromePath); +#endif if (NS_FAILED(rv)) return rv; diff --git a/ipc/glue/GeckoChildProcessHost.cpp b/ipc/glue/GeckoChildProcessHost.cpp index d8558b1bb..27297ae1c 100644 --- a/ipc/glue/GeckoChildProcessHost.cpp +++ b/ipc/glue/GeckoChildProcessHost.cpp @@ -561,8 +561,23 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt // Make sure that child processes can find the omnijar // See XRE_InitCommandLine in nsAppRunner.cpp newEnvVars["UXP_CUSTOM_OMNI"] = 1; - nsAutoCString path; nsCOMPtr<nsIFile> file = Omnijar::GetPath(Omnijar::GRE); +#ifdef XP_WIN + nsString path; + nsAutoCString childPath; + if (file && NS_SUCCEEDED(file->GetPath(path))) { + CopyUTF16toUTF8(path, childPath); + childArgv.push_back("-greomni"); + childArgv.push_back(childPath.get()); + } + file = Omnijar::GetPath(Omnijar::APP); + if (file && NS_SUCCEEDED(file->GetPath(path))) { + CopyUTF16toUTF8(path, childPath); + childArgv.push_back("-appomni"); + childArgv.push_back(childPath.get()); + } +#else + nsAutoCString path; if (file && NS_SUCCEEDED(file->GetNativePath(path))) { childArgv.push_back("-greomni"); childArgv.push_back(path.get()); @@ -572,6 +587,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt childArgv.push_back("-appomni"); childArgv.push_back(path.get()); } +#endif } // Add the application directory path (-appdir path) diff --git a/layout/printing/ipc/RemotePrintJobParent.cpp b/layout/printing/ipc/RemotePrintJobParent.cpp index 7005bab5a..98d5dd2ee 100644 --- a/layout/printing/ipc/RemotePrintJobParent.cpp +++ b/layout/printing/ipc/RemotePrintJobParent.cpp @@ -117,7 +117,11 @@ RemotePrintJobParent::PrintPage(const nsCString& aPageFileName) } nsAutoCString recordingPath; +#ifdef XP_WIN + rv = recordingFile->GetPersistentDescriptor(recordingPath); +#else rv = recordingFile->GetNativePath(recordingPath); +#endif if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } diff --git a/mailnews/addrbook/src/nsAddrDatabase.cpp b/mailnews/addrbook/src/nsAddrDatabase.cpp index 463437958..51dbe8237 100644 --- a/mailnews/addrbook/src/nsAddrDatabase.cpp +++ b/mailnews/addrbook/src/nsAddrDatabase.cpp @@ -482,7 +482,11 @@ NS_IMETHODIMP nsAddrDatabase::OpenMDB(nsIFile *dbName, bool create) nsIMdbThumb *thumb = nullptr; nsAutoCString filePath; +#ifdef XP_WIN + ret = dbName->GetPersistentDescriptor(filePath); +#else ret = dbName->GetNativePath(filePath); +#endif NS_ENSURE_SUCCESS(ret, ret); nsIMdbHeap* dbHeap = nullptr; diff --git a/mailnews/base/src/nsMessenger.cpp b/mailnews/base/src/nsMessenger.cpp index 8719530f7..99a1c83d9 100644 --- a/mailnews/base/src/nsMessenger.cpp +++ b/mailnews/base/src/nsMessenger.cpp @@ -598,7 +598,11 @@ nsMessenger::DetachAttachmentsWOPrompts(nsIFile* aDestFolder, NS_ENSURE_SUCCESS(rv, rv); nsAutoCString path; +#ifdef XP_WIN + rv = attachmentDestination->GetPersistentDescriptor(path); +#else rv = attachmentDestination->GetNativePath(path); +#endif NS_ENSURE_SUCCESS(rv, rv); nsAutoString unescapedFileName; @@ -854,7 +858,11 @@ nsMessenger::SaveOneAttachment(const char * aContentType, const char * aURL, SetLastSaveDirectory(localFile); nsCString dirName; +#ifdef XP_WIN + rv = localFile->GetPersistentDescriptor(dirName); +#else rv = localFile->GetNativePath(dirName); +#endif NS_ENSURE_SUCCESS(rv, rv); nsSaveAllAttachmentsState *saveState = @@ -921,7 +929,11 @@ nsMessenger::SaveAllAttachments(uint32_t count, nsCString dirName; nsSaveAllAttachmentsState *saveState = nullptr; +#ifdef XP_WIN + rv = localFile->GetPersistentDescriptor(dirName); +#else rv = localFile->GetNativePath(dirName); +#endif NS_ENSURE_SUCCESS(rv, rv); saveState = new nsSaveAllAttachmentsState(count, diff --git a/mailnews/base/src/nsMsgFolderCache.cpp b/mailnews/base/src/nsMsgFolderCache.cpp index 9510a6e3d..caab422aa 100644 --- a/mailnews/base/src/nsMsgFolderCache.cpp +++ b/mailnews/base/src/nsMsgFolderCache.cpp @@ -236,7 +236,11 @@ NS_IMETHODIMP nsMsgFolderCache::Init(nsIFile *aFile) aFile->Exists(&exists); nsAutoCString dbPath; +#ifdef XP_WIN + aFile->GetPersistentDescriptor(dbPath); +#else aFile->GetNativePath(dbPath); +#endif // ### evil cast until MDB supports file streams. nsresult rv = OpenMDB(dbPath, exists); // if this fails and panacea.dat exists, try blowing away the db and recreating it diff --git a/mailnews/compose/src/nsMsgCompUtils.cpp b/mailnews/compose/src/nsMsgCompUtils.cpp index 6632e3257..f31c5dc1f 100644 --- a/mailnews/compose/src/nsMsgCompUtils.cpp +++ b/mailnews/compose/src/nsMsgCompUtils.cpp @@ -118,7 +118,11 @@ nsMsgCreateTempFileName(const char *tFileName) return nullptr; nsCString tempString; +#ifdef XP_WIN + rv = tmpFile->GetPersistentDescriptor(tempString); +#else rv = tmpFile->GetNativePath(tempString); +#endif if (NS_FAILED(rv)) return nullptr; diff --git a/mailnews/compose/src/nsMsgCompose.cpp b/mailnews/compose/src/nsMsgCompose.cpp index a7c2140ad..3dbf74187 100644 --- a/mailnews/compose/src/nsMsgCompose.cpp +++ b/mailnews/compose/src/nsMsgCompose.cpp @@ -4518,7 +4518,11 @@ nsMsgCompose::ProcessSignature(nsIMsgIdentity *identity, bool aQuoted, nsString { rv = identity->GetSignature(getter_AddRefs(sigFile)); if (NS_SUCCEEDED(rv) && sigFile) { +#ifdef XP_WIN + rv = sigFile->GetPersistentDescriptor(sigNativePath); +#else rv = sigFile->GetNativePath(sigNativePath); +#endif if (NS_SUCCEEDED(rv) && !sigNativePath.IsEmpty()) { bool exists = false; sigFile->Exists(&exists); diff --git a/mailnews/db/msgdb/src/nsMsgDatabase.cpp b/mailnews/db/msgdb/src/nsMsgDatabase.cpp index 31da7bc5e..96e74359c 100644 --- a/mailnews/db/msgdb/src/nsMsgDatabase.cpp +++ b/mailnews/db/msgdb/src/nsMsgDatabase.cpp @@ -939,7 +939,11 @@ NS_IMETHODIMP nsMsgDatabase::NotifyAnnouncerGoingAway(void) bool nsMsgDatabase::MatchDbName(nsIFile *dbName) // returns true if they match { nsCString dbPath; +#ifdef XP_WIN + dbName->GetPersistentDescriptor(dbPath); +#else dbName->GetNativePath(dbPath); +#endif return dbPath.Equals(m_dbName); } @@ -1197,7 +1201,11 @@ nsresult nsMsgDatabase::OpenInternal(nsMsgDBService *aDBService, bool aLeaveInvalidDB, bool sync) { nsAutoCString summaryFilePath; +#ifdef XP_WIN + summaryFile->GetPersistentDescriptor(summaryFilePath); +#else summaryFile->GetNativePath(summaryFilePath); +#endif MOZ_LOG(DBLog, LogLevel::Info, ("nsMsgDatabase::Open(%s, %s, %p, %s)\n", (const char*)summaryFilePath.get(), aCreate ? "TRUE":"FALSE", diff --git a/mailnews/imap/src/nsImapMailFolder.cpp b/mailnews/imap/src/nsImapMailFolder.cpp index da1411cd0..04d639512 100644 --- a/mailnews/imap/src/nsImapMailFolder.cpp +++ b/mailnews/imap/src/nsImapMailFolder.cpp @@ -3203,7 +3203,7 @@ NS_IMETHODIMP nsImapMailFolder::BeginCopy(nsIMsgDBHdr *message) if (NS_FAILED(rv)) { nsCString nativePath; - m_copyState->m_tmpFile->GetNativePath(nativePath); + m_copyState->m_tmpFile->GetPersistentDescriptor(nativePath); MOZ_LOG(IMAP, mozilla::LogLevel::Info, ("couldn't remove prev temp file %s: %lx\n", nativePath.get(), rv)); } m_copyState->m_tmpFile = nullptr; @@ -8883,7 +8883,11 @@ NS_IMETHODIMP nsImapMailFolder::RenameSubFolders(nsIMsgWindow *msgWindow, nsIMsg newParentPathFile->AppendNative(oldLeafName); nsCString newPathStr; +#ifdef XP_WIN + newParentPathFile->GetPersistentDescriptor(newPathStr); +#else newParentPathFile->GetNativePath(newPathStr); +#endif nsCOMPtr<nsIFile> newPathFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); diff --git a/mailnews/import/outlook/src/MapiMessage.cpp b/mailnews/import/outlook/src/MapiMessage.cpp index 6b02db314..2536c1680 100644 --- a/mailnews/import/outlook/src/MapiMessage.cpp +++ b/mailnews/import/outlook/src/MapiMessage.cpp @@ -887,7 +887,11 @@ bool CMapiMessage::CopyBinAttachToFile(LPATTACH lpAttach, NS_ENSURE_SUCCESS(rv, false); nsCString tmpPath; +#ifdef XP_WIN + _tmp_file->GetPersistentDescriptor(tmpPath); +#else _tmp_file->GetNativePath(tmpPath); +#endif LPSTREAM lpStreamFile; HRESULT hr = CMapiApi::OpenStreamOnFile(gpMapiAllocateBuffer, gpMapiFreeBuffer, STGM_READWRITE | STGM_CREATE, const_cast<char*>(tmpPath.get()), NULL, &lpStreamFile); diff --git a/mailnews/local/src/nsLocalUtils.cpp b/mailnews/local/src/nsLocalUtils.cpp index 14a6a2f21..aac4290a9 100644 --- a/mailnews/local/src/nsLocalUtils.cpp +++ b/mailnews/local/src/nsLocalUtils.cpp @@ -150,7 +150,11 @@ nsLocalURI2Path(const char* rootURI, const char* uriStr, nsCString localNativePath; +#ifdef XP_WIN + localPath->GetPersistentDescriptor(localNativePath); +#else localPath->GetNativePath(localNativePath); +#endif nsEscapeNativePath(localNativePath); pathResult = localNativePath.get(); const char *curPos = uriStr + PL_strlen(rootURI); diff --git a/mailnews/local/src/nsMailboxService.cpp b/mailnews/local/src/nsMailboxService.cpp index 00a0d87c8..3621df262 100644 --- a/mailnews/local/src/nsMailboxService.cpp +++ b/mailnews/local/src/nsMailboxService.cpp @@ -52,7 +52,11 @@ nsresult nsMailboxService::ParseMailbox(nsIMsgWindow *aMsgWindow, nsIFile *aMail // okay now generate the url string nsCString mailboxPath; +#ifdef XP_WIN + aMailboxPath->GetPersistentDescriptor(mailboxPath); +#else aMailboxPath->GetNativePath(mailboxPath); +#endif nsAutoCString buf; MsgEscapeURL(mailboxPath, nsINetUtil::ESCAPE_URL_MINIMAL | nsINetUtil::ESCAPE_URL_FORCED, buf); diff --git a/system/interface/nsDeviceContextSpecProxy.cpp b/system/interface/nsDeviceContextSpecProxy.cpp index df0927237..7ff3c6e97 100644 --- a/system/interface/nsDeviceContextSpecProxy.cpp +++ b/system/interface/nsDeviceContextSpecProxy.cpp @@ -169,7 +169,11 @@ nsDeviceContextSpecProxy::CreateUniqueTempPath(nsACString& aFilePath) return rv; } +#ifdef XP_WIN + return recordingFile->GetPersistentDescriptor(aFilePath); +#else return recordingFile->GetNativePath(aFilePath); +#endif } NS_IMETHODIMP diff --git a/system/interface/windows/WinTaskbar.cpp b/system/interface/windows/WinTaskbar.cpp index 530cfd5b9..3c00fae7a 100644 --- a/system/interface/windows/WinTaskbar.cpp +++ b/system/interface/windows/WinTaskbar.cpp @@ -1,4 +1,3 @@ -/* vim: se cin sw=2 ts=2 et : */ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- * * This Source Code Form is subject to the terms of the Mozilla Public @@ -246,7 +245,7 @@ WinTaskbar::GetAppUserModelID(nsAString & aDefaultGroupId) { bool exists = false; if (profileDir && NS_SUCCEEDED(profileDir->Exists(&exists)) && exists) { nsAutoCString path; - if (NS_SUCCEEDED(profileDir->GetNativePath(path))) { + if (NS_SUCCEEDED(profileDir->GetPersistentDescriptor(path))) { nsAutoString id; id.AppendInt(HashString(path)); if (!id.IsEmpty()) { diff --git a/system/interface/windows/nsDataObj.cpp b/system/interface/windows/nsDataObj.cpp index 39b269d0d..81dcb8f16 100644 --- a/system/interface/windows/nsDataObj.cpp +++ b/system/interface/windows/nsDataObj.cpp @@ -1294,7 +1294,7 @@ nsDataObj :: GetFileContentsInternetShortcut ( FORMATETC& aFE, STGMEDIUM& aSTG ) rv = mozilla::widget::FaviconHelper::GetOutputIconPath(aUri, icoFile, true); NS_ENSURE_SUCCESS(rv, E_FAIL); - rv = icoFile->GetNativePath(path); + rv = icoFile->GetPersistentDescriptor(path); NS_ENSURE_SUCCESS(rv, E_FAIL); shortcutFormatStr = "[InternetShortcut]\r\nURL=%s\r\n" diff --git a/system/network/base/nsDirectoryIndexStream.cpp b/system/network/base/nsDirectoryIndexStream.cpp index 87a57fd57..7b51a952d 100644 --- a/system/network/base/nsDirectoryIndexStream.cpp +++ b/system/network/base/nsDirectoryIndexStream.cpp @@ -1,17 +1,13 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* vim:set sw=4 sts=4 et cin: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - /* - The converts a filesystem directory into an "HTTP index" stream per Lou Montulli's original spec: http://www.mozilla.org/projects/netlib/dirindexformat.html - */ #include "nsEscape.h" @@ -92,7 +88,7 @@ nsDirectoryIndexStream::Init(nsIFile* aDir) if (MOZ_LOG_TEST(gLog, LogLevel::Debug)) { nsAutoCString path; - aDir->GetNativePath(path); + aDir->GetPersistentDescriptor(path); MOZ_LOG(gLog, LogLevel::Debug, ("nsDirectoryIndexStream[%p]: initialized on %s", this, path.get())); @@ -239,7 +235,7 @@ nsDirectoryIndexStream::Read(char* aBuf, uint32_t aCount, uint32_t* aReadCount) if (MOZ_LOG_TEST(gLog, LogLevel::Debug)) { nsAutoCString path; - current->GetNativePath(path); + current->GetPersistentDescriptor(path); MOZ_LOG(gLog, LogLevel::Debug, ("nsDirectoryIndexStream[%p]: iterated %s", this, path.get())); diff --git a/system/network/base/nsStandardURL.cpp b/system/network/base/nsStandardURL.cpp index 57337e480..083a5178b 100644 --- a/system/network/base/nsStandardURL.cpp +++ b/system/network/base/nsStandardURL.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* vim:set ts=4 sw=4 sts=4 et cindent: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ @@ -3159,7 +3158,7 @@ nsStandardURL::GetFile(nsIFile **result) if (LOG_ENABLED()) { nsAutoCString path; - mFile->GetNativePath(path); + mFile->GetPersistentDescriptor(path); LOG(("nsStandardURL::GetFile [this=%p spec=%s resulting_path=%s]\n", this, mSpec.get(), path.get())); } diff --git a/system/network/cache/nsCache.cpp b/system/network/cache/nsCache.cpp index 7f5d6a071..b3ecfeae2 100644 --- a/system/network/cache/nsCache.cpp +++ b/system/network/cache/nsCache.cpp @@ -20,11 +20,19 @@ void CacheLogPrintPath(mozilla::LogLevel level, const char * format, nsIFile * item) { nsAutoCString path; +#ifdef XP_WIN + nsresult rv = item->GetPersistentDescriptor(path); +#else nsresult rv = item->GetNativePath(path); +#endif if (NS_SUCCEEDED(rv)) { MOZ_LOG(gCacheLog, level, (format, path.get())); } else { +#ifdef XP_WIN + MOZ_LOG(gCacheLog, level, ("GetPersistentDescriptor failed: %x", rv)); +#else MOZ_LOG(gCacheLog, level, ("GetNativePath failed: %x", rv)); +#endif } } diff --git a/system/network/cache/nsCacheService.cpp b/system/network/cache/nsCacheService.cpp index 6c8e5f5b8..50bf1095e 100644 --- a/system/network/cache/nsCacheService.cpp +++ b/system/network/cache/nsCacheService.cpp @@ -1739,7 +1739,7 @@ nsCacheService::CreateCustomOfflineDevice(nsIFile *aProfileDir, if (MOZ_LOG_TEST(gCacheLog, LogLevel::Info)) { nsAutoCString profilePath; - aProfileDir->GetNativePath(profilePath); + aProfileDir->GetPersistentDescriptor(profilePath); CACHE_LOG_INFO(("Creating custom offline device, %s, %d", profilePath.BeginReading(), aQuota)); } @@ -3093,7 +3093,11 @@ nsCacheService::MoveOrRemoveDiskCache(nsIFile *aOldCacheDir, return; nsAutoCString newPath; +#ifdef XP_WIN + rv = aNewCacheSubdir->GetPersistentDescriptor(newPath); +#else rv = aNewCacheSubdir->GetNativePath(newPath); +#endif if (NS_FAILED(rv)) return; @@ -3105,7 +3109,11 @@ nsCacheService::MoveOrRemoveDiskCache(nsIFile *aOldCacheDir, rv = aNewCacheDir->Create(nsIFile::DIRECTORY_TYPE, 0777); if (NS_SUCCEEDED(rv) || NS_ERROR_FILE_ALREADY_EXISTS == rv) { nsAutoCString oldPath; +#ifdef XP_WIN + rv = aOldCacheSubdir->GetPersistentDescriptor(oldPath); +#else rv = aOldCacheSubdir->GetNativePath(oldPath); +#endif if (NS_FAILED(rv)) return; if (rename(oldPath.get(), newPath.get()) == 0) diff --git a/system/network/cache/nsDiskCacheDeviceSQL.cpp b/system/network/cache/nsDiskCacheDeviceSQL.cpp index 297c0f362..caacf92a2 100644 --- a/system/network/cache/nsDiskCacheDeviceSQL.cpp +++ b/system/network/cache/nsDiskCacheDeviceSQL.cpp @@ -287,7 +287,7 @@ nsOfflineCacheEvictionFunction::Apply() for (int32_t i = 0; i < items.Count(); i++) { if (MOZ_LOG_TEST(gCacheLog, LogLevel::Debug)) { nsAutoCString path; - items[i]->GetNativePath(path); + items[i]->GetPersistentDescriptor(path); LOG((" removing %s\n", path.get())); } diff --git a/system/network/cache2/CacheFileContextEvictor.cpp b/system/network/cache2/CacheFileContextEvictor.cpp index 65feb4462..fd4e97550 100644 --- a/system/network/cache2/CacheFileContextEvictor.cpp +++ b/system/network/cache2/CacheFileContextEvictor.cpp @@ -269,7 +269,11 @@ CacheFileContextEvictor::PersistEvictionInfoToDisk( } nsAutoCString path; +#ifdef XP_WIN + file->GetPersistentDescriptor(path); +#else file->GetNativePath(path); +#endif PRFileDesc *fd; rv = file->OpenNSPRFileDesc(PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE, 0600, @@ -306,7 +310,11 @@ CacheFileContextEvictor::RemoveEvictInfoFromDisk( } nsAutoCString path; +#ifdef XP_WIN + file->GetPersistentDescriptor(path); +#else file->GetNativePath(path); +#endif rv = file->Remove(false); if (NS_WARN_IF(NS_FAILED(rv))) { diff --git a/system/network/cache2/CacheFileIOManager.cpp b/system/network/cache2/CacheFileIOManager.cpp index 845ad7314..627d06ffa 100644 --- a/system/network/cache2/CacheFileIOManager.cpp +++ b/system/network/cache2/CacheFileIOManager.cpp @@ -3096,7 +3096,11 @@ nsresult CacheFileIOManager::TrashDirectory(nsIFile *aFile) { nsAutoCString path; +#ifdef XP_WIN + aFile->GetPersistentDescriptor(path); +#else aFile->GetNativePath(path); +#endif LOG(("CacheFileIOManager::TrashDirectory() [file=%s]", path.get())); nsresult rv; @@ -3340,7 +3344,7 @@ CacheFileIOManager::RemoveTrashInternal() "recursively, but this can block IO thread for a while!"); if (LOG_ENABLED()) { nsAutoCString path; - file->GetNativePath(path); + file->GetPersistentDescriptor(path); LOG(("CacheFileIOManager::RemoveTrashInternal() - Found a directory in a trash " "directory! It will be removed recursively, but this can block IO " "thread for a while! [file=%s]", path.get())); @@ -3873,7 +3877,7 @@ CacheFileIOManager::SyncRemoveDir(nsIFile *aFile, const char *aDir) if (LOG_ENABLED()) { nsAutoCString path; - file->GetNativePath(path); + file->GetPersistentDescriptor(path); LOG(("CacheFileIOManager::SyncRemoveDir() - Removing directory %s", path.get())); } diff --git a/system/network/exthandler/nsMIMEInfoImpl.cpp b/system/network/exthandler/nsMIMEInfoImpl.cpp index 59886e465..ca2372274 100644 --- a/system/network/exthandler/nsMIMEInfoImpl.cpp +++ b/system/network/exthandler/nsMIMEInfoImpl.cpp @@ -305,7 +305,11 @@ nsMIMEInfoBase::LaunchWithFile(nsIFile* aFile) NS_ENSURE_SUCCESS(rv, rv); nsAutoCString path; +#ifdef XP_WIN + aFile->GetPersistentDescriptor(path); +#else aFile->GetNativePath(path); +#endif return LaunchWithIProcess(executable, path); } @@ -423,7 +427,11 @@ nsMIMEInfoImpl::LaunchDefaultWithFile(nsIFile* aFile) return NS_ERROR_FILE_NOT_FOUND; nsAutoCString nativePath; +#ifdef XP_WIN + aFile->GetPersistentDescriptor(nativePath); +#else aFile->GetNativePath(nativePath); +#endif return LaunchWithIProcess(mDefaultApplication, nativePath); } diff --git a/system/network/test/TestFileInput2.cpp b/system/network/test/TestFileInput2.cpp index f51988010..c75d7677c 100644 --- a/system/network/test/TestFileInput2.cpp +++ b/system/network/test/TestFileInput2.cpp @@ -323,8 +323,8 @@ Test(CreateFun create, uint32_t count, nsAutoCString inDir; nsAutoCString outDir; - (void)inDirSpec->GetNativePath(inDir); - (void)outDirSpec->GetNativePath(outDir); + (void)inDirSpec->GetPersistentDescriptor(inDir); + (void)outDirSpec->GetPersistentDescriptor(outDir); printf("###########\nTest: from %s to %s, bufSize = %d\n", inDir.get(), outDir.get(), bufSize); gTimeSampler.Reset(); diff --git a/system/runtime/nsUpdateDriver.cpp b/system/runtime/nsUpdateDriver.cpp index 812818788..dadae7ba1 100644 --- a/system/runtime/nsUpdateDriver.cpp +++ b/system/runtime/nsUpdateDriver.cpp @@ -958,7 +958,13 @@ nsUpdateProcessor::ProcessUpdate(nsIUpdate* aUpdate) rv = ds->Get(XRE_EXECUTABLE_FILE, NS_GET_IID(nsIFile), getter_AddRefs(binary)); NS_ASSERTION(NS_SUCCEEDED(rv), "Can't get the binary path"); +#ifdef XP_WIN + nsAutoString binPathW; + binary->GetPath(binPathW); + NS_ConvertUTF16toUTF8 binPath(binPathW); +#else binary->GetNativePath(binPath); +#endif } // Copy the parameters to the StagedUpdateInfo structure shared with the diff --git a/system/security/manager/ssl/CertBlocklist.cpp b/system/security/manager/ssl/CertBlocklist.cpp index 8701032ed..43b99b359 100644 --- a/system/security/manager/ssl/CertBlocklist.cpp +++ b/system/security/manager/ssl/CertBlocklist.cpp @@ -193,7 +193,11 @@ CertBlocklist::Init() return rv; } nsAutoCString path; +#ifdef XP_WIN + rv = mBackingFile->GetPersistentDescriptor(path); +#else rv = mBackingFile->GetNativePath(path); +#endif if (NS_FAILED(rv)) { return rv; } 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)) { |