20 lines
590 B
Nim
20 lines
590 B
Nim
import os
|
|
|
|
echo("Input KSM directory")
|
|
let mainDir: string = readLine(stdin)
|
|
let userDir: string = mainDir & DirSep & "score" & DirSep & "PLAYER"
|
|
let outFileName: string = mainDir & DirSep & "songs" & DirSep & "Played.fav"
|
|
var f: File
|
|
if open(f, outFileName, fmWrite):
|
|
try:
|
|
for kind, path in walkDir(userDir, true):
|
|
if kind == pcDir:
|
|
let fullPath = userDir & DirSep & path
|
|
for k2, p2 in walkDir(fullPath, true):
|
|
if k2 == pcDir:
|
|
f.writeLine(path & DirSep & p2)
|
|
finally:
|
|
close(f)
|
|
else:
|
|
quit("Error writing to file: " & outFileName)
|