Return success boolean from FioRenameFile
This commit is contained in:
@@ -374,12 +374,18 @@ void FioCreateDirectory(const std::string &name)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void FioRenameFile(const std::string &oldname, const std::string &newname)
|
/**
|
||||||
|
* Renames a file from oldname to newname.
|
||||||
|
* @param oldname file name to rename from
|
||||||
|
* @param newname file name to rename to
|
||||||
|
* @return true iff the operation succeeded
|
||||||
|
*/
|
||||||
|
bool FioRenameFile(const std::string &oldname, const std::string &newname)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
_wrename(OTTD2FS(oldname).c_str(), OTTD2FS(newname).c_str());
|
return _wrename(OTTD2FS(oldname).c_str(), OTTD2FS(newname).c_str()) == 0;
|
||||||
#else
|
#else
|
||||||
rename(oldname.c_str(), newname.c_str());
|
return rename(oldname.c_str(), newname.c_str()) == 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@ std::string FioFindFullPath(Subdirectory subdir, const std::string &filename);
|
|||||||
std::string FioGetDirectory(Searchpath sp, Subdirectory subdir);
|
std::string FioGetDirectory(Searchpath sp, Subdirectory subdir);
|
||||||
std::string FioFindDirectory(Subdirectory subdir);
|
std::string FioFindDirectory(Subdirectory subdir);
|
||||||
void FioCreateDirectory(const std::string &name);
|
void FioCreateDirectory(const std::string &name);
|
||||||
void FioRenameFile(const std::string &oldname, const std::string &newname);
|
bool FioRenameFile(const std::string &oldname, const std::string &newname);
|
||||||
|
|
||||||
const char *FiosGetScreenshotDir();
|
const char *FiosGetScreenshotDir();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user