version 1.31.8.2, 2007/04/23 21:24:04
|
version 1.32, 2007/10/17 20:38:06
|
|
|
FileSystem::translateSlashes(fileName); | FileSystem::translateSlashes(fileName); |
if (FileSystem::isDirectory(fileName)) | if (FileSystem::isDirectory(fileName)) |
{ | { |
return 0; |
return false; |
} | } |
| |
// Check if the file exists and is writable | // Check if the file exists and is writable |
if (FileSystem::exists(fileName)) | if (FileSystem::exists(fileName)) |
{ | { |
if (!FileSystem::canWrite(fileName)) |
return FileSystem::canWrite(fileName); |
{ |
|
return 0; |
|
} |
|
else |
|
{ |
|
return 1; |
|
} | } |
} |
|
else |
|
{ |
|
// Check if directory is writable | // Check if directory is writable |
Uint32 index = fileName.reverseFind('/'); | Uint32 index = fileName.reverseFind('/'); |
| |
if (index != PEG_NOT_FOUND) | if (index != PEG_NOT_FOUND) |
{ | { |
String dirName = fileName.subString(0,index); | String dirName = fileName.subString(0,index); |
if (!FileSystem::isDirectory(dirName)) |
|
{ |
if (dirName.size() == 0) |
return 0; |
|
} |
|
if (!FileSystem::canWrite(dirName) ) |
|
{ | { |
return 0; |
dirName = "/"; |
} | } |
else |
|
|
if (!FileSystem::isDirectory(dirName)) |
{ | { |
return 1; |
return false; |
} | } |
|
|
|
return FileSystem::canWrite(dirName); |
} | } |
else |
|
{ |
|
String currentDir; | String currentDir; |
| |
// Check if there is permission to write in the | // Check if there is permission to write in the |
// current working directory | // current working directory |
FileSystem::getCurrentDirectory(currentDir); | FileSystem::getCurrentDirectory(currentDir); |
| |
if (!FileSystem::canWrite(currentDir)) |
return FileSystem::canWrite(currentDir); |
{ |
|
return 0; |
|
} |
|
else |
|
{ |
|
return 1; |
|
} |
|
} |
|
} |
|
PEGASUS_UNREACHABLE(return 1;) |
|
} | } |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |