use openspace fileExists function

This commit is contained in:
Andreas Engberg
2024-04-19 11:11:20 +02:00
parent 9011f7f6e0
commit 7e65a3a32d
+1 -7
View File
@@ -6,14 +6,8 @@ asset.require("scene/solarsystem/planets/earth/earth")
local localBookmarks = openspace.absPath("${USER}/bookmarks/localbookmarks.csv")
-- Returns true if the file exists and can be opened for reading and false otherwise
function file_exists(name)
local f=io.open(name,"r")
return f~=nil and io.close(f)
end
-- Create bookmarks file if it does not exist
if not file_exists(localBookmarks) then
if not openspace.fileExists(localBookmarks) then
local file = io.open(localBookmarks, "w")
file:write(
"Group (optional),Name (required),Globe (optional),Lat (required if globe)," ..