Changeset 16395 in vbox for trunk/src/libs/xpcom18a4/xpcom
- Timestamp:
- Jan 29, 2009 11:38:21 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/xpcom/io/nsLocalFileCommon.cpp
r1 r16395 62 62 } 63 63 64 #if !defined(XP_MAC) && !defined(XP_MACOSX)64 #if (!defined(XP_MAC) && !defined(XP_MACOSX)) || (defined(VBOX) && defined(RT_ARCH_AMD64)) 65 65 NS_IMETHODIMP 66 66 nsLocalFile::InitWithFile(nsILocalFile *aFile) 67 67 { 68 68 NS_ENSURE_ARG(aFile); 69 69 70 70 nsCAutoString path; 71 71 aFile->GetNativePath(path); 72 72 if (path.IsEmpty()) 73 73 return NS_ERROR_INVALID_ARG; 74 return InitWithNativePath(path); 74 return InitWithNativePath(path); 75 75 } 76 76 #endif … … 80 80 #else 81 81 #define kMaxFilenameLength 255 82 #endif 82 #endif 83 83 84 84 NS_IMETHODIMP … … 86 86 { 87 87 nsresult rv = Create(type, attributes); 88 88 89 89 if (NS_SUCCEEDED(rv)) return NS_OK; 90 90 if (rv != NS_ERROR_FILE_ALREADY_EXISTS) return rv; 91 91 92 nsCAutoString leafName; 92 nsCAutoString leafName; 93 93 rv = GetNativeLeafName(leafName); 94 94 … … 117 117 118 118 rv = Create(type, attributes); 119 120 if (NS_SUCCEEDED(rv) || rv != NS_ERROR_FILE_ALREADY_EXISTS) 119 120 if (NS_SUCCEEDED(rv) || rv != NS_ERROR_FILE_ALREADY_EXISTS) 121 121 { 122 122 return rv; 123 123 } 124 124 } 125 125 126 126 // The disk is full, sort of 127 127 return NS_ERROR_FILE_TOO_BIG; … … 150 150 PRUnichar **nodePtr = nodeArray; 151 151 if (*path == kPathSeparatorChar) 152 path++; 152 path++; 153 153 *nodePtr++ = path; 154 154 155 155 for (PRUnichar *cp = path; *cp != 0; cp++) { 156 156 if (*cp == kPathSeparatorChar) { … … 166 166 } 167 167 168 168 169 169 NS_IMETHODIMP 170 170 nsLocalFile::GetRelativeDescriptor(nsILocalFile *fromFile, nsACString& _retval) … … 175 175 // 176 176 // _retval will be UTF-8 encoded 177 // 178 177 // 178 179 179 nsresult rv; 180 180 _retval.Truncate(0); … … 183 183 PRUnichar *thisNodes[kMaxNodesInPath], *fromNodes[kMaxNodesInPath]; 184 184 PRInt32 thisNodeCnt, fromNodeCnt, nodeIndex; 185 185 186 186 rv = GetPath(thisPath); 187 187 if (NS_FAILED(rv)) … … 194 194 PRUnichar *thisPathPtr; thisPath.BeginWriting(thisPathPtr); 195 195 PRUnichar *fromPathPtr; fromPath.BeginWriting(fromPathPtr); 196 196 197 197 thisNodeCnt = SplitPath(thisPathPtr, thisNodes, kMaxNodesInPath); 198 198 fromNodeCnt = SplitPath(fromPathPtr, fromNodes, kMaxNodesInPath); 199 199 if (thisNodeCnt < 0 || fromNodeCnt < 0) 200 200 return NS_ERROR_FAILURE; 201 201 202 202 for (nodeIndex = 0; nodeIndex < thisNodeCnt && nodeIndex < fromNodeCnt; ++nodeIndex) { 203 203 #ifdef XP_WIN … … 209 209 #endif 210 210 } 211 211 212 212 PRInt32 branchIndex = nodeIndex; 213 for (nodeIndex = branchIndex; nodeIndex < fromNodeCnt; nodeIndex++) 213 for (nodeIndex = branchIndex; nodeIndex < fromNodeCnt; nodeIndex++) 214 214 _retval.AppendLiteral("../"); 215 215 for (nodeIndex = branchIndex; nodeIndex < thisNodeCnt; nodeIndex++) { … … 222 222 _retval.Append('/'); 223 223 } 224 224 225 225 return NS_OK; 226 226 } … … 230 230 { 231 231 NS_NAMED_LITERAL_CSTRING(kParentDirStr, "../"); 232 232 233 233 nsCOMPtr<nsIFile> targetFile; 234 234 nsresult rv = fromFile->Clone(getter_AddRefs(targetFile)); … … 238 238 // 239 239 // relativeDesc is UTF-8 encoded 240 // 240 // 241 241 242 242 nsCString::const_iterator strBegin, strEnd; 243 243 relativeDesc.BeginReading(strBegin); 244 244 relativeDesc.EndReading(strEnd); 245 245 246 246 nsCString::const_iterator nodeBegin(strBegin), nodeEnd(strEnd); 247 247 nsCString::const_iterator pos(strBegin); 248 248 249 249 nsCOMPtr<nsIFile> parentDir; 250 250 while (FindInReadable(kParentDirStr, nodeBegin, nodeEnd)) { … … 263 263 FindCharInReadable('/', nodeEnd, strEnd); 264 264 #ifdef XP_MAC 265 nsCAutoString nodeString(Substring(nodeBegin, nodeEnd)); 265 nsCAutoString nodeString(Substring(nodeBegin, nodeEnd)); 266 266 nodeString.ReplaceSubstring(kESCSlashStr, kSlashStr); 267 267 targetFile->Append(NS_ConvertUTF8toUCS2(nodeString));
Note:
See TracChangeset
for help on using the changeset viewer.