From 3cf6049c09c7a98d013f83f5552f09f1d93731f8 Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Sat, 6 Nov 2021 15:21:18 +0000 Subject: [PATCH] Can now customise output 'folder' name --- ksmplayedsongs.nim | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ksmplayedsongs.nim b/ksmplayedsongs.nim index f3e0606..b71ebf9 100644 --- a/ksmplayedsongs.nim +++ b/ksmplayedsongs.nim @@ -2,13 +2,12 @@ import os echo("Input KSM directory") let mainDir: string = readLine(stdin) -var playerName: string = "" echo("If your ingame player name is not 'PLAYER' enter it now (otherwise press enter)") -playerName = readLine(stdin) -if playerName == "": - playerName = "PLAYER" -let userDir: string = mainDir & DirSep & "score" & DirSep & playerName -let outFileName: string = mainDir & DirSep & "songs" & DirSep & "Played.fav" +let playerName: string = readLine(stdin) +let userDir: string = mainDir & DirSep & "score" & DirSep & (if len(playerName) > 0: playerName else: "PLAYER") +echo("Enter the name of the 'folder' to create (or just leave empty for 'Played')") +let dirName: string = readLine(stdin) +let outFileName: string = mainDir & DirSep & "songs" & DirSep & (if len(dirName) > 0: dirName & ".fav" else: "Played.fav") var f: File if open(f, outFileName, fmWrite): try: