Skip to content

Commit

Permalink
images folder might not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
joneugster committed Dec 7, 2023
1 parent 0e65225 commit d5697d0
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions server/GameServer/Commands.lean
Original file line number Diff line number Diff line change
Expand Up @@ -688,17 +688,18 @@ open IO.FS System FilePath in
/-- Copies the folder `images/` to `.lake/gamedata/images/` -/
def copyImages : IO Unit := do
let target : FilePath := ".lake" / "gamedata"
for file in ← walkDir "images" do
let outFile := target.join file
-- create the directories
if ← file.isDir then
createDirAll outFile
else
if let some parent := outFile.parent then
createDirAll parent
-- copy file
let content ← readBinFile file
writeBinFile outFile content
if ← FilePath.pathExists "images" then
for file in ← walkDir "images" do
let outFile := target.join file
-- create the directories
if ← file.isDir then
createDirAll outFile
else
if let some parent := outFile.parent then
createDirAll parent
-- copy file
let content ← readBinFile file
writeBinFile outFile content



Expand Down

0 comments on commit d5697d0

Please sign in to comment.