mirror of
https://github.com/TimeCrafters/timecrafters_configuration_tool_desktop.git
synced 2025-12-15 21:32:35 +00:00
Initial implementation of search, updated PacketHandler to behave more more like android app
This commit is contained in:
@@ -41,6 +41,30 @@ module TAC
|
||||
@config_changed = false
|
||||
end
|
||||
|
||||
def move_config(old_name, new_name)
|
||||
if not File.exists?("#{TAC::CONFIGS_PATH}/#{old_name}.json") or
|
||||
File.directory?("#{TAC::CONFIGS_PATH}/#{old_name}.json")
|
||||
# move_config: Can not move config file "#{old_name}" does not exist!
|
||||
return false
|
||||
end
|
||||
|
||||
if File.exists?("#{TAC::CONFIGS_PATH}/#{new_name}.json") &&
|
||||
!File.directory?("#{TAC::CONFIGS_PATH}/#{old_name}.json")
|
||||
# move_config: Config file "#{new_name}" already exist!
|
||||
return false
|
||||
end
|
||||
|
||||
return FileUtils.mv(
|
||||
"#{TAC::CONFIGS_PATH}/#{old_name}.json",
|
||||
"#{TAC::CONFIGS_PATH}/#{new_name}.json"
|
||||
)
|
||||
end
|
||||
|
||||
def delete_config(config_name)
|
||||
FileUtils.rm("#{TAC::CONFIGS_PATH}/#{config_name}.json") if File.exists?("#{TAC::CONFIGS_PATH}/#{config_name}.json")
|
||||
end
|
||||
|
||||
|
||||
def upload_config(config_name)
|
||||
if @tacnet.connected?
|
||||
json = Config.new(config_name).to_json
|
||||
|
||||
Reference in New Issue
Block a user