remove hardly used TimeMachine feature
This commit is contained in:
parent
b132965330
commit
79ec95a9b5
4 changed files with 3 additions and 59 deletions
|
|
@ -17,7 +17,6 @@ const
|
|||
hasFFI* = defined(useFFI)
|
||||
newScopeForIf* = true
|
||||
useCaas* = not defined(noCaas)
|
||||
noTimeMachine* = defined(avoidTimeMachine) and defined(macosx)
|
||||
copyrightYear* = "2018"
|
||||
|
||||
type # please make sure we have under 32 options
|
||||
|
|
@ -329,28 +328,6 @@ proc toGeneratedFile*(path, ext: string): string =
|
|||
result = joinPath([getNimcacheDir(), changeFileExt(tail, ext)])
|
||||
#echo "toGeneratedFile(", path, ", ", ext, ") = ", result
|
||||
|
||||
when noTimeMachine:
|
||||
var alreadyExcludedDirs = initSet[string]()
|
||||
proc excludeDirFromTimeMachine(dir: string) {.raises: [].} =
|
||||
## Calls a macosx command on the directory to exclude it from backups.
|
||||
##
|
||||
## The macosx tmutil command is invoked to mark the specified path as an
|
||||
## item to be excluded from time machine backups. If a path already exists
|
||||
## with files before excluding it, newer files won't be added to the
|
||||
## directory, but previous files won't be removed from the backup until the
|
||||
## user deletes that directory.
|
||||
##
|
||||
## The whole proc is optional and will ignore all kinds of errors. The only
|
||||
## way to be sure that it works is to call ``tmutil isexcluded path``.
|
||||
if alreadyExcludedDirs.contains(dir): return
|
||||
alreadyExcludedDirs.incl(dir)
|
||||
try:
|
||||
var p = startProcess("/usr/bin/tmutil", args = ["addexclusion", dir])
|
||||
discard p.waitForExit
|
||||
p.close
|
||||
except Exception:
|
||||
discard
|
||||
|
||||
proc completeGeneratedFilePath*(f: string, createSubDir: bool = true): string =
|
||||
var (head, tail) = splitPath(f)
|
||||
#if len(head) > 0: head = removeTrailingDirSep(shortenDir(head & dirSep))
|
||||
|
|
@ -358,8 +335,6 @@ proc completeGeneratedFilePath*(f: string, createSubDir: bool = true): string =
|
|||
if createSubDir:
|
||||
try:
|
||||
createDir(subdir)
|
||||
when noTimeMachine:
|
||||
excludeDirFromTimeMachine(subdir)
|
||||
except OSError:
|
||||
writeLine(stdout, "cannot create directory: " & subdir)
|
||||
quit(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue