diff options
author | Moonchild <moonchild@palemoon.org> | 2022-05-09 22:38:16 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2022-05-09 22:38:16 +0000 |
commit | 9edf1b7bea5ff893f88911fc1a6a2dca3faeece9 (patch) | |
tree | 98bd9b0c7e3ca3e517e9e43dea157707b13f6bdb /modules/libjar/nsJAR.cpp | |
parent | 930ddd693be251c86ee904dafbaef38234b692c0 (diff) | |
download | uxp-getnativepath-work.tar.gz |
Issue #1896 - Port GetNativePath changes from GRE.getnativepath-work
Diffstat (limited to 'modules/libjar/nsJAR.cpp')
-rw-r--r-- | modules/libjar/nsJAR.cpp | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/modules/libjar/nsJAR.cpp b/modules/libjar/nsJAR.cpp index 96e18e1d31..a9a696cf75 100644 --- a/modules/libjar/nsJAR.cpp +++ b/modules/libjar/nsJAR.cpp @@ -271,11 +271,7 @@ nsJAR::Extract(const nsACString &aEntryName, nsIFile* outFile) if (NS_FAILED(rv)) return rv; // ExtractFile also closes the fd handle and resolves the symlink if needed - nsAutoCString path; - rv = outFile->GetNativePath(path); - if (NS_FAILED(rv)) return rv; - - rv = mZip->ExtractFile(item, path.get(), fd); + rv = mZip->ExtractFile(item, outFile, fd); } if (NS_FAILED(rv)) return rv; @@ -422,7 +418,11 @@ nsJAR::GetJarPath(nsACString& aResult) { NS_ENSURE_ARG_POINTER(mZipFile); +#ifdef XP_WIN + return mZipFile->GetPersistentDescriptor(aResult); +#else return mZipFile->GetNativePath(aResult); +#endif } nsresult @@ -1124,7 +1124,11 @@ nsZipReaderCache::IsCached(nsIFile* zipFile, bool* aResult) MutexAutoLock lock(mLock); nsAutoCString uri; +#ifdef XP_WIN + rv = zipFile->GetPersistentDescriptor(uri); +#else rv = zipFile->GetNativePath(uri); +#endif if (NS_FAILED(rv)) return rv; @@ -1146,8 +1150,14 @@ nsZipReaderCache::GetZip(nsIFile* zipFile, nsIZipReader* *result) #endif nsAutoCString uri; +#ifdef XP_WIN + rv = zipFile->GetPersistentDescriptor(uri); +#else rv = zipFile->GetNativePath(uri); - if (NS_FAILED(rv)) return rv; +#endif + if (NS_FAILED(rv)) { + return rv; + } uri.Insert(NS_LITERAL_CSTRING("file:"), 0); @@ -1190,8 +1200,14 @@ nsZipReaderCache::GetInnerZip(nsIFile* zipFile, const nsACString &entry, #endif nsAutoCString uri; +#ifdef XP_WIN + rv = zipFile->GetPersistentDescriptor(uri); +#else rv = zipFile->GetNativePath(uri); - if (NS_FAILED(rv)) return rv; +#endif + if (NS_FAILED(rv)) { + return rv; + } uri.Insert(NS_LITERAL_CSTRING("jar:"), 0); uri.AppendLiteral("!/"); @@ -1233,7 +1249,11 @@ nsZipReaderCache::GetFd(nsIFile* zipFile, PRFileDesc** aRetVal) nsresult rv; nsAutoCString uri; +#ifdef XP_WIN + rv = zipFile->GetPersistentDescriptor(uri); +#else rv = zipFile->GetNativePath(uri); +#endif if (NS_FAILED(rv)) { return rv; } @@ -1374,8 +1394,13 @@ nsZipReaderCache::Observe(nsISupports *aSubject, return NS_OK; nsAutoCString uri; +#ifdef XP_WIN + if (NS_FAILED(file->GetPersistentDescriptor(uri))) + return NS_OK; +#else if (NS_FAILED(file->GetNativePath(uri))) return NS_OK; +#endif uri.Insert(NS_LITERAL_CSTRING("file:"), 0); |