-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Godot File Handler #268
Merged
AsherGlick
merged 10 commits into
AsherGlick:xml_converter
from
klingbolt:godot_file_handler
May 18, 2024
Merged
Godot File Handler #268
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
cdb4e5a
Changed name of file that will hold all functions for loading and sav…
klingbolt 629d3ee
Removed extra lines
klingbolt fecd28d
Spliting xml converter functions into seperate file from dialogs
klingbolt 10f7c71
removed extra space
klingbolt 61b44e7
changed to static functions and updated naming
klingbolt b022773
Moved variables back to pack dialog
klingbolt 7757841
Move variable creation to ready function
klingbolt bccee54
Removed lines from File Handler
klingbolt e333616
fixed function that calls only one program to only call that program.…
klingbolt 6f0ee47
changed to constant variable
klingbolt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
static func call_xml_converter(args: PoolStringArray): | ||
var output: Array = [] | ||
print(args) | ||
var result: int = OS.execute("./xml_converter/build/xml_converter", args, true, output, true) | ||
print(output) | ||
if result != OK: | ||
print("Failed to execute the converter. Error code:", result) | ||
else: | ||
print("Command executed successfully.") | ||
|
||
static func create_directory_if_missing(path: String): | ||
var dir = Directory.new() | ||
if not dir.dir_exists(path): | ||
var success = dir.make_dir(path) | ||
if success != OK: | ||
print("Error: Could not create data folder:", path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
extends FileDialog | ||
|
||
const FileHandler = preload("res://FileHandler.gd") | ||
AsherGlick marked this conversation as resolved.
Show resolved
Hide resolved
|
||
var downloaded_markers_dir: String | ||
var unsaved_markers_dir: String | ||
var user_data_dir: String | ||
|
||
func _ready(): | ||
#TODO: Move these to global file Settings so they can be customized | ||
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") | ||
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: 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) | ||
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) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can probably be a constant variable in FileHandler instead of a magic string here.
Also: does this work with the exported files? I think it is fine if not right now but we will need to test it to be sure.