mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 455394 Crash reporter fails if your Firefox profile is in a volume other than /home
r=luser
This commit is contained in:
parent
da105abed8
commit
c455d9beb7
@ -41,6 +41,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <dlfcn.h>
|
||||
@ -879,7 +880,35 @@ bool UIFileExists(const string& path)
|
||||
|
||||
bool UIMoveFile(const string& file, const string& newfile)
|
||||
{
|
||||
return (rename(file.c_str(), newfile.c_str()) != -1);
|
||||
if (!rename(file.c_str(), newfile.c_str()))
|
||||
return true;
|
||||
if (errno != EXDEV)
|
||||
return false;
|
||||
|
||||
// use system /bin/mv instead, time to fork
|
||||
pid_t pID = vfork();
|
||||
if (pID < 0) {
|
||||
// Failed to fork
|
||||
return false;
|
||||
}
|
||||
if (pID == 0) {
|
||||
char* const args[4] = {
|
||||
"mv",
|
||||
strdup(file.c_str()),
|
||||
strdup(newfile.c_str()),
|
||||
0
|
||||
};
|
||||
if (args[1] && args[2])
|
||||
execve("/bin/mv", args, 0);
|
||||
if (args[1])
|
||||
free(args[1]);
|
||||
if (args[2])
|
||||
free(args[2]);
|
||||
exit(-1);
|
||||
}
|
||||
int status;
|
||||
waitpid(pID, &status, 0);
|
||||
return UIFileExists(newfile);
|
||||
}
|
||||
|
||||
bool UIDeleteFile(const string& file)
|
||||
|
@ -866,7 +866,19 @@ bool UIFileExists(const string& path)
|
||||
|
||||
bool UIMoveFile(const string& file, const string& newfile)
|
||||
{
|
||||
return (rename(file.c_str(), newfile.c_str()) != -1);
|
||||
if (!rename(file.c_str(), newfile.c_str()))
|
||||
return true;
|
||||
if (errno != EXDEV)
|
||||
return false;
|
||||
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSString *source = [fileManager stringWithFileSystemRepresentation:file.c_str() length:file.length()];
|
||||
NSString *dest = [fileManager stringWithFileSystemRepresentation:newfile.c_str() length:newfile.length()];
|
||||
if (!source || !dest)
|
||||
return false;
|
||||
|
||||
[fileManager movePath:source toPath:dest handler:nil];
|
||||
return UIFileExists(newfile);
|
||||
}
|
||||
|
||||
bool UIDeleteFile(const string& file)
|
||||
|
Loading…
Reference in New Issue
Block a user