-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
220 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#include "fastcopy.h" | ||
|
||
using namespace std; | ||
using namespace std::filesystem; | ||
|
||
namespace Utils | ||
{ | ||
error_code copy(const path& source, const path& dest, bool overwriteExisting) | ||
{ | ||
error_code ec; | ||
|
||
auto options = copy_options::none; | ||
if (overwriteExisting) | ||
{ | ||
options = copy_options::overwrite_existing; | ||
} | ||
|
||
if (copy_file(source, dest, options, ec)) | ||
{ | ||
remove(source, ec); | ||
} | ||
|
||
return ec; | ||
} | ||
|
||
error_code copy(const string& source, const string& dest, bool overwriteExisting) | ||
{ | ||
return copy(path(source), path(dest), overwriteExisting); | ||
} | ||
|
||
error_code fastcopy(const string& source, const string& dest, bool overwriteExisting) | ||
{ | ||
return fastcopy(path(source), path(dest), overwriteExisting); | ||
} | ||
|
||
error_code fastcopy(const path& source, const path& dest, bool overwriteExisting) | ||
{ | ||
error_code ec; | ||
|
||
try | ||
{ | ||
rename(source, dest); | ||
} | ||
catch (filesystem_error& fe) | ||
{ | ||
// can't rename across devices- try standard copy and remove | ||
if (fe.code() == std::errc::cross_device_link) | ||
{ | ||
ec = copy(source, dest, overwriteExisting); | ||
} | ||
else | ||
{ | ||
throw fe; | ||
} | ||
} | ||
|
||
return ec; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
|
||
#include <filesystem> | ||
#include <string> | ||
#include "utils_export.h" | ||
|
||
namespace Utils | ||
{ | ||
UTILS_EXPORT std::error_code copy(const std::filesystem::path& source, const std::filesystem::path& dest, bool overwriteExisting); | ||
UTILS_EXPORT std::error_code copy(const std::string& source, const std::string& dest, bool overwriteExisting); | ||
|
||
UTILS_EXPORT std::error_code fastcopy(const std::string& source, const std::string& dest, bool overwriteExisting); | ||
UTILS_EXPORT std::error_code fastcopy(const std::filesystem::path& source, const std::filesystem::path& dest, bool overwriteExisting); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolume | ||
metadata: | ||
name: k3d-volume | ||
#name: task-pv-volume | ||
labels: | ||
type: local | ||
spec: | ||
storageClassName: manual | ||
capacity: | ||
storage: 1Ti | ||
accessModes: | ||
- ReadWriteOnce | ||
hostPath: | ||
path: /mnt/d/k3dvolume |
Oops, something went wrong.