forked from mia/Aegisub
Remove the dangerous CopyFile function that on Unix attempted to create hard links of files instead of copying them. Replace it with wxCopyFile instead. Patch by jfs. Fixes #912.
Originally committed to SVN as r3129.
This commit is contained in:
parent
68481215c9
commit
2f65a5bb68
4 changed files with 2 additions and 21 deletions
|
@ -546,7 +546,7 @@ int FontsCollectorThread::CopyFont(wxString filename) {
|
|||
wxFileName fn(filename);
|
||||
wxString dstName = destFolder + _T("//") + fn.GetFullName();
|
||||
if (wxFileName::FileExists(dstName)) return 2;
|
||||
return CopyFile(filename,dstName) ? 1 : 0;
|
||||
return wxCopyFile(filename,dstName,true) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -725,7 +725,7 @@ void FrameMain::LoadSubtitles (wxString filename,wxString charset) {
|
|||
|
||||
// Save
|
||||
wxString backup = path + origfile.GetName() + _T(".ORIGINAL.") + origfile.GetExt();
|
||||
CopyFile(filename,backup);
|
||||
wxCopyFile(filename,backup,true);
|
||||
}
|
||||
|
||||
// Sync
|
||||
|
|
|
@ -74,24 +74,6 @@ int CountMatches(wxString parent,wxString child) {
|
|||
}
|
||||
|
||||
|
||||
///////////////
|
||||
// Copy a file
|
||||
bool CopyFile(wxString src,wxString dst) {
|
||||
// Windows
|
||||
#if defined(__WINDOWS__)
|
||||
BOOL result = CopyFile(src.wc_str(),dst.wc_str(),false);
|
||||
return (result != 0);
|
||||
|
||||
// Linux
|
||||
#elif defined(__UNIX__)
|
||||
return link(src.mb_str(),dst.mb_str()) != 0;
|
||||
|
||||
// Error
|
||||
#else
|
||||
#error "don't know how to backup files"
|
||||
#endif
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
// Make a path relative to reference
|
||||
wxString MakeRelativePath(wxString _path,wxString reference) {
|
||||
|
|
|
@ -56,7 +56,6 @@ typedef std::vector<std::pair<int,int> > IntPairVector;
|
|||
int64_t abs64(int64_t input);
|
||||
#endif
|
||||
int CountMatches(wxString parent,wxString child);
|
||||
bool CopyFile(wxString src,wxString dst);
|
||||
wxString MakeRelativePath(wxString path,wxString reference);
|
||||
wxString DecodeRelativePath(wxString path,wxString reference);
|
||||
wxString PrettyFloat(wxString src);
|
||||
|
|
Loading…
Reference in a new issue