mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-04 07:40:42 +00:00
removing MoveToFollowingLinks(). It was discussed that was not needed due
to links being broken. r=shaver more tweeks to get symlinks working correct on windows. not part of the build yet.
This commit is contained in:
parent
18a8f9f113
commit
8b94c587f9
@ -155,15 +155,6 @@ interface nsIFile : nsISupports
|
||||
*/
|
||||
void moveTo(in nsIFile newParentDir, [const] in string newName);
|
||||
|
||||
/**
|
||||
* moveToFollowingLinks
|
||||
*
|
||||
* This function is identical to moveTo except it, as
|
||||
* the name implies, follows symbolic links.
|
||||
*/
|
||||
|
||||
void moveToFollowingLinks(in nsIFile newParentDir, [const] in string newName);
|
||||
|
||||
/**
|
||||
* This will try to execute this file. It will not block for
|
||||
* execution. 'args' will be passed through on the command line
|
||||
|
@ -377,8 +377,17 @@ nsLocalFile::ResolvePath(const char* workingPath, PRBool resolveTerminal, char**
|
||||
size_t offset = strlen(filePath) - 4;
|
||||
if ((offset > 0) && (strncmp( (filePath + offset), ".lnk", 4) == 0))
|
||||
{
|
||||
// Ensure that the string is Unicode.
|
||||
MultiByteToWideChar(CP_ACP, 0, filePath, -1, wsz, MAX_PATH);
|
||||
}
|
||||
else
|
||||
{
|
||||
char linkStr[MAX_PATH];
|
||||
strcpy(linkStr, filePath);
|
||||
strcat(linkStr, ".lnk");
|
||||
|
||||
// Ensure that the string is Unicode.
|
||||
MultiByteToWideChar(CP_ACP, 0, linkStr, -1, wsz, MAX_PATH);
|
||||
}
|
||||
|
||||
HRESULT hres;
|
||||
|
||||
@ -415,22 +424,6 @@ nsLocalFile::ResolvePath(const char* workingPath, PRBool resolveTerminal, char**
|
||||
{
|
||||
strcat(temp, "\\");
|
||||
}
|
||||
else
|
||||
{
|
||||
// check to see the file is a shortcut by the magic .lnk extension.
|
||||
size_t offset = strlen(temp) - 4;
|
||||
if ((offset > 0) && (strncmp( (temp + offset), ".lnk", 4) == 0))
|
||||
{
|
||||
strcat(temp, "\\");
|
||||
}
|
||||
else
|
||||
{
|
||||
// it is not an shortcut, we have an error!
|
||||
nsAllocator::Free(temp);
|
||||
nsAllocator::Free(filePath);
|
||||
return NS_ERROR_FILE_INVALID_PATH;
|
||||
}
|
||||
}
|
||||
|
||||
if (slash)
|
||||
{
|
||||
@ -459,13 +452,6 @@ nsLocalFile::ResolvePath(const char* workingPath, PRBool resolveTerminal, char**
|
||||
return NS_ERROR_FILE_INVALID_PATH;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// could not load shortcut. Return error;
|
||||
nsAllocator::Free(filePath);
|
||||
return NS_ERROR_FILE_INVALID_PATH;
|
||||
}
|
||||
}
|
||||
|
||||
if (slash)
|
||||
{
|
||||
@ -503,11 +489,23 @@ nsLocalFile::ResolveAndStat(PRBool resolveTerminal)
|
||||
|
||||
|
||||
const char *filePath = mResolvedPath.GetBuffer();
|
||||
BOOL result;
|
||||
|
||||
if ( 0 == GetFileAttributesEx( filePath,
|
||||
GetFileExInfoStandard,
|
||||
&mFileAttrData) )
|
||||
result = GetFileAttributesEx( filePath, GetFileExInfoStandard, &mFileAttrData);
|
||||
if ( 0 == result )
|
||||
{
|
||||
if (resolveTerminal == false)
|
||||
{
|
||||
char linkStr[MAX_PATH];
|
||||
strcpy(linkStr, filePath);
|
||||
strcat(linkStr, ".lnk");
|
||||
result = GetFileAttributesEx( linkStr, GetFileExInfoStandard, &mFileAttrData);
|
||||
|
||||
if ( 0 == result)
|
||||
{
|
||||
return ConvertWinError(GetLastError());
|
||||
}
|
||||
}
|
||||
return ConvertWinError(GetLastError());
|
||||
}
|
||||
|
||||
@ -818,7 +816,10 @@ nsLocalFile::CopyMove(nsIFile *newParentDir, const char *newName, PRBool followS
|
||||
|
||||
PRBool isDir;
|
||||
IsDirectory(&isDir);
|
||||
if (!isDir)
|
||||
PRBool isSymlink;
|
||||
IsSymlink(&isSymlink);
|
||||
|
||||
if (!isDir || (isSymlink && !followSymlinks))
|
||||
{
|
||||
rv = CopySingleFile(this, newParentDir, newName, followSymlinks, move);
|
||||
if (NS_FAILED(rv))
|
||||
@ -898,7 +899,7 @@ nsLocalFile::CopyMove(nsIFile *newParentDir, const char *newName, PRBool followS
|
||||
if (move)
|
||||
{
|
||||
if (followSymlinks)
|
||||
rv = file->MoveToFollowingLinks(target, nsnull);
|
||||
rv = NS_ERROR_FAILURE;
|
||||
else
|
||||
rv = file->MoveTo(target, nsnull);
|
||||
}
|
||||
@ -955,12 +956,6 @@ nsLocalFile::MoveTo(nsIFile *newParentDir, const char *newName)
|
||||
return CopyMove(newParentDir, newName, PR_FALSE, PR_TRUE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::MoveToFollowingLinks(nsIFile *newParentDir, const char *newName)
|
||||
{
|
||||
return CopyMove(newParentDir, newName, PR_TRUE, PR_TRUE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::Spawn(const char *args)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user