@@ -17,7 +17,7 @@ requires "tinydialogs >= 1.0.0"
17
17
requires " constructor >= 1.2.0"
18
18
19
19
import std/ [strformat, options]
20
- import src/ types
20
+ import src/ configtype
21
21
22
22
const config = initConfig()
23
23
@@ -28,13 +28,12 @@ let arch = getEnv("ARCH", "amd64")
28
28
let outPath = getEnv(" OUTPATH" , toExe & " { config.name} -{ version} -{ arch} " )
29
29
let flags = getEnv(" FLAGS" )
30
30
31
- let args = & " --app:gui --out:{ outPath} --cpu:{ arch} -d:configPath= { configPath } { flags} "
31
+ let args = & " --app:gui --out:{ outPath} --cpu:{ arch} { flags} "
32
32
33
33
task buildr, " Build the application for release" :
34
- exec " nimble install -d -y"
35
- exec & " nim c -d:release { args} main.nim "
34
+ exec & " nimble c -d:release { args} main.nim "
36
35
37
- const desktop = """
36
+ const desktopTemplate = """
38
37
[Desktop Entry]
39
38
Name=$name
40
39
Exec=AppRun
@@ -52,14 +51,13 @@ task buildapp, "Build the AppImage":
52
51
let appimagePath = & " { config.name} -{ version} -{ arch} .AppImage"
53
52
54
53
# Compile applicaiton executable
55
- if not existsDir(" AppDir" ): mkDir(" AppDir" )
56
- exec " nimble install -d -y"
57
- exec & " nim c -d:release -d:appimage { args} --out:AppDir/AppRun main.nim "
54
+ if not dirExists(" AppDir" ): mkDir(" AppDir" )
55
+ exec & " nimble c -d:release -d:appimage { args} --out:AppDir/AppRun main.nim "
58
56
59
57
# Make desktop file
60
58
writeFile(
61
59
& " AppDir/{ config.name} .desktop " ,
62
- desktop % [
60
+ desktopTemplate % [
63
61
" name" , config.name,
64
62
" categories" , config.categories.join(" ;" ),
65
63
" version" , config.version,
@@ -71,9 +69,9 @@ task buildapp, "Build the AppImage":
71
69
cpFile(config.iconPath, " AppDir/.DirIcon" )
72
70
cpFile(config.svgIconPath, & " AppDir/{ config.name} .svg " )
73
71
74
- if config.appstreamPath.isSome :
72
+ if config.appstreamPath.len > 0 :
75
73
mkDir(" AppDir/usr/share/metainfo" )
76
- cpFile(config.appstreamPath.get , & " AppDir/usr/share/metainfo/{ config.name} .appdata.xml " )
74
+ cpFile(config.appstreamPath, & " AppDir/usr/share/metainfo/{ config.name} .appdata.xml " )
77
75
78
76
# Get appimagetool
79
77
var appimagetoolPath = " appimagetool"
@@ -82,15 +80,15 @@ task buildapp, "Build the AppImage":
82
80
exec(& " { appimagetoolPath} --help" )
83
81
except OSError:
84
82
appimagetoolPath = " ./appimagetool-x86_64.AppImage"
85
- if not existsFile (appimagetoolPath):
83
+ if not fileExists (appimagetoolPath):
86
84
echo & " Downloading { appimagetoolPath} "
87
- exec & " wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O " , appimagetoolPath
85
+ exec & " wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O { appimagetoolPath} "
88
86
exec & " chmod +x { appimagetoolPath} "
89
87
90
88
# Actually use appimagetool to build the AppImage
91
89
if config.ghRepo.isSome:
92
90
echo " Building updateable AppImage"
93
- exec & " { appimagetoolPath} -u \" gh-releases-zsync|{ config.ghRepo.get[ 0 ] } |{ config.ghRepo.get[ 0 ] } |latest|{ config.name} -*-{ arch} .AppImage.zsync\" AppDir { appimagePath} "
91
+ exec & " { appimagetoolPath} -u \" gh-releases-zsync|{ config.ghRepo.get.user } |{ config.ghRepo.get.repo } |latest|{ config.name} -*-{ arch} .AppImage.zsync\" AppDir { appimagePath} "
94
92
else :
95
93
echo & " ghRepo not defined. Skipping updateable AppImage "
96
94
exec & " { appimagetoolPath} AppDir { appimagePath} "
0 commit comments