From b3e1a3c133a56de6434bc1752580e00c77e18dd6 Mon Sep 17 00:00:00 2001 From: yuki Date: Fri, 9 Aug 2024 12:06:28 +0800 Subject: [PATCH] Setup task does not wipe existing config files. --- config.nims | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/config.nims b/config.nims index 0750d26..ff5a907 100644 --- a/config.nims +++ b/config.nims @@ -31,13 +31,22 @@ proc configure() = configpath = XDG_CONFIG_HOME & "/catnap/" echo "Creating " & configpath - mkdir(configpath) + if dirExists(configpath): + echo "Configuration directory already exists, skipping..." + else: + mkdir(configpath) echo "Creating " & configpath & "config.toml" - cpFile(thisDir() & "/config/config.toml", configpath & "config.toml") + if fileExists(configpath & "config.toml"): + echo "Configuration file already exists, skipping..." + else: + cpFile(thisDir() & "/config/config.toml", configpath & "config.toml") echo "Creating " & configpath & "distros.toml" - cpFile(thisDir() & "/config/distros.toml", configpath & "distros.toml") + if fileExists(configpath & "distros.toml"): + echo "Distro art file already exists, skipping..." + else: + cpFile(thisDir() & "/config/distros.toml", configpath & "distros.toml") task release, "Builds the project in release mode": echo "\e[36;1mBuilding\e[0;0m in release mode"