43 lines
770 B
Julia
43 lines
770 B
Julia
|
saveDir = "~/.config/spacetrack"
|
||
|
|
||
|
|
||
|
|
||
|
function savegame(
|
||
|
playerid::String,
|
||
|
playerName::String,
|
||
|
shipName::String,
|
||
|
createSave::Bool
|
||
|
)
|
||
|
|
||
|
local io = IOBuffer()
|
||
|
|
||
|
|
||
|
|
||
|
if createSave == true
|
||
|
mkpath(saveDir)
|
||
|
|
||
|
print("Name youe save file: ")
|
||
|
saveFileName = readline()
|
||
|
|
||
|
if isempty(saveFileName) == true
|
||
|
|
||
|
global saveFile = untitled.conf
|
||
|
else
|
||
|
|
||
|
saveFile = saveFileName
|
||
|
end
|
||
|
|
||
|
open("$saveDir/$saveFile", "w") do io
|
||
|
write(io, "player-id = ", playerid, "\n")
|
||
|
write(io, "pilot-name = ", playerName, "\n");
|
||
|
write(io, "ship-name = ", shipName, "\n");
|
||
|
end;
|
||
|
|
||
|
close(io)
|
||
|
end
|
||
|
|
||
|
return saveFile
|
||
|
|
||
|
end
|
||
|
|
||
|
saveFile = saveFile
|