Skip to content

Commit 23ab073

Browse files
committed
Actual v2 (the previous commit saying v2 was v1)
1 parent 0b00c02 commit 23ab073

File tree

5 files changed

+196
-263
lines changed

5 files changed

+196
-263
lines changed

ImExample.nimble

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ requires "tinydialogs >= 1.0.0"
1717
requires "constructor >= 1.2.0"
1818

1919
import std/[strformat, options]
20-
import src/types
20+
import src/configtype
2121

2222
const config = initConfig()
2323

@@ -28,13 +28,12 @@ let arch = getEnv("ARCH", "amd64")
2828
let outPath = getEnv("OUTPATH", toExe &"{config.name}-{version}-{arch}")
2929
let flags = getEnv("FLAGS")
3030

31-
let args = &"--app:gui --out:{outPath} --cpu:{arch} -d:configPath={configPath} {flags}"
31+
let args = &"--app:gui --out:{outPath} --cpu:{arch} {flags}"
3232

3333
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"
3635

37-
const desktop = """
36+
const desktopTemplate = """
3837
[Desktop Entry]
3938
Name=$name
4039
Exec=AppRun
@@ -52,14 +51,13 @@ task buildapp, "Build the AppImage":
5251
let appimagePath = &"{config.name}-{version}-{arch}.AppImage"
5352

5453
# 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"
5856

5957
# Make desktop file
6058
writeFile(
6159
&"AppDir/{config.name}.desktop",
62-
desktop % [
60+
desktopTemplate % [
6361
"name", config.name,
6462
"categories", config.categories.join(";"),
6563
"version", config.version,
@@ -71,9 +69,9 @@ task buildapp, "Build the AppImage":
7169
cpFile(config.iconPath, "AppDir/.DirIcon")
7270
cpFile(config.svgIconPath, &"AppDir/{config.name}.svg")
7371

74-
if config.appstreamPath.isSome:
72+
if config.appstreamPath.len > 0:
7573
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")
7775

7876
# Get appimagetool
7977
var appimagetoolPath = "appimagetool"
@@ -82,15 +80,15 @@ task buildapp, "Build the AppImage":
8280
exec(&"{appimagetoolPath} --help")
8381
except OSError:
8482
appimagetoolPath = "./appimagetool-x86_64.AppImage"
85-
if not existsFile(appimagetoolPath):
83+
if not fileExists(appimagetoolPath):
8684
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}"
8886
exec &"chmod +x {appimagetoolPath}"
8987

9088
# Actually use appimagetool to build the AppImage
9189
if config.ghRepo.isSome:
9290
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}"
9492
else:
9593
echo &"ghRepo not defined. Skipping updateable AppImage"
9694
exec &"{appimagetoolPath} AppDir {appimagePath}"

0 commit comments

Comments
 (0)