Skip to content

Commit

Permalink
Removed lines from File Handler
Browse files Browse the repository at this point in the history
  • Loading branch information
klingbolt committed Apr 27, 2024
1 parent 7757841 commit bccee54
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
16 changes: 2 additions & 14 deletions FileHandler.gd
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
var downloaded_markers_dir: String
var unsaved_markers_dir: String
var user_data_dir: String

func _init():
self.user_data_dir = str(OS.get_user_data_dir())
self.downloaded_markers_dir = self.user_data_dir.plus_file("packs")
self.unsaved_markers_dir = self.user_data_dir.plus_file("protobins")
create_directory_if_missing(self.downloaded_markers_dir)
create_directory_if_missing(self.unsaved_markers_dir)

static func call_xml_converter(args):
var executable_path: String = "./xml_converter/build/xml_converter"
static func call_xml_converter(executable_path: String, args: PoolStringArray):
var output: Array = []
print(args)
var result: int = OS.execute(executable_path, args, true, output, true)
Expand All @@ -20,7 +8,7 @@ static func call_xml_converter(args):
else:
print("Command executed successfully.")

static func create_directory_if_missing(path):
static func create_directory_if_missing(path: String):
var dir = Directory.new()
if not dir.dir_exists(path):
var success = dir.make_dir(path)
Expand Down
7 changes: 5 additions & 2 deletions ImportPackDialog.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const FileHandler = preload("res://FileHandler.gd")
var downloaded_markers_dir: String
var unsaved_markers_dir: String
var user_data_dir: String
var executable_path: String = "./xml_converter/build/xml_converter"

func _ready():
self.user_data_dir = str(OS.get_user_data_dir())
Expand All @@ -12,13 +13,15 @@ func _ready():
FileHandler.create_directory_if_missing(self.downloaded_markers_dir)
FileHandler.create_directory_if_missing(self.unsaved_markers_dir)

func _on_FileDialog_dir_selected(dir_path):
func _on_FileDialog_dir_selected(dir_path: String):
print("Selected folder:", dir_path)
var new_path: String = self.downloaded_markers_dir.plus_file(dir_path.get_file())
FileHandler.create_directory_if_missing(new_path)
#else:
# #Pop up here to confirm overwrite?
var args: PoolStringArray = [
"--input-taco-path", dir_path,
"--output-waypoint-path", new_path,
"--output-split-waypoint-path", self.unsaved_markers_dir
]
FileHandler.call_xml_converter(args)
FileHandler.call_xml_converter(self.executable_path, args)

0 comments on commit bccee54

Please sign in to comment.