Skip to content

Commit

Permalink
fix #95
Browse files Browse the repository at this point in the history
  • Loading branch information
bitwes committed Dec 4, 2018
1 parent 46a2cce commit 09f1e6e
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions addons/gut/doubler.gd
Original file line number Diff line number Diff line change
Expand Up @@ -159,19 +159,29 @@ func double(path):
return load(_double(path))

func clear_output_directory():
var d = Directory.new()
d.open(_output_dir)
d.list_dir_begin(true)
var files = []
var f = d.get_next()
while(f != ''):
d.remove(f)
f = d.get_next()
var did = false
if(_output_dir.find('user://') == 0):
var d = Directory.new()
var result = d.open(_output_dir)
# BIG GOTCHA HERE. If it cannot open the dir w/ erro 31, then the
# directory becomes res:// and things go on normally and gut clears out
# out res:// which is SUPER BAD.
if(result == OK):
d.list_dir_begin(true)
var files = []
var f = d.get_next()
while(f != ''):
print('deleting ', f)
d.remove(f)
f = d.get_next()
did = true
return did

func delete_output_directory():
clear_output_directory()
var d = Directory.new()
d.remove(_output_dir)
var did = clear_output_directory()
if(did):
var d = Directory.new()
d.remove(_output_dir)

func set_use_unique_names(should):
_use_unique_names = should

0 comments on commit 09f1e6e

Please sign in to comment.