mirror of
https://github.com/MaskRay/ccls.git
synced 2025-02-21 16:09:40 +00:00
Add MoveFileTo
This commit is contained in:
parent
ea5508a699
commit
a9bac06b83
@ -39,6 +39,7 @@ void SetCurrentThreadName(const std::string& thread_name);
|
|||||||
|
|
||||||
int64_t GetLastModificationTime(const std::string& absolute_path);
|
int64_t GetLastModificationTime(const std::string& absolute_path);
|
||||||
|
|
||||||
|
void MoveFileTo(const std::string& destination, const std::string& source);
|
||||||
void CopyFileTo(const std::string& destination, const std::string& source);
|
void CopyFileTo(const std::string& destination, const std::string& source);
|
||||||
|
|
||||||
bool IsSymLink(const std::string& path);
|
bool IsSymLink(const std::string& path);
|
||||||
|
@ -186,6 +186,11 @@ int64_t GetLastModificationTime(const std::string& absolute_path) {
|
|||||||
return buf.st_mtime;
|
return buf.st_mtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MoveFileTo(const std::string& dest, const std::string& source) {
|
||||||
|
// TODO/FIXME - do a real move.
|
||||||
|
CopyFileTo(dest, source);
|
||||||
|
}
|
||||||
|
|
||||||
// See http://stackoverflow.com/q/13198627
|
// See http://stackoverflow.com/q/13198627
|
||||||
void CopyFileTo(const std::string& dest, const std::string& source) {
|
void CopyFileTo(const std::string& dest, const std::string& source) {
|
||||||
int fd_from = open(source.c_str(), O_RDONLY);
|
int fd_from = open(source.c_str(), O_RDONLY);
|
||||||
|
@ -204,6 +204,11 @@ int64_t GetLastModificationTime(const std::string& absolute_path) {
|
|||||||
return buf.st_mtime;
|
return buf.st_mtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MoveFileTo(const std::string& destination, const std::string& source) {
|
||||||
|
MoveFile(source.c_str(),
|
||||||
|
destination.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
void CopyFileTo(const std::string& destination, const std::string& source) {
|
void CopyFileTo(const std::string& destination, const std::string& source) {
|
||||||
CopyFile(
|
CopyFile(
|
||||||
source.c_str(),
|
source.c_str(),
|
||||||
|
Loading…
Reference in New Issue
Block a user