Skip to content

Commit

Permalink
Check path if exist before initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlin committed Jul 20, 2020
1 parent bbaaf70 commit 1d93408
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions scratchip/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,18 @@ def create(self, top):

def init(self):
cache_path = os.path.join(self.prj_path, self.scratchip_path)
self.extract_cache(mill_cache.source, cache_path)
mill_path = os.path.join(self.prj_path, self.scratchip_path + '/mill')
jars_path = os.path.join(self.prj_path, self.scratchip_path + '/jars')
os.makedirs(jars_path)
shutil.copyfile(mill_bin.source, mill_path)
shutil.copyfile(chisel3_jar.source, os.path.join(jars_path, 'chisel3.jar'))
chisel3_jar_path = os.path.join(jars_path, 'chisel3.jar')

if not os.path.exists(cache_path):
self.extract_cache(mill_cache.source, cache_path)
if not os.path.exists(mill_path):
shutil.copyfile(mill_bin.source, mill_path)
if not os.path.exists(jars_path):
os.makedirs(jars_path)
if not os.path.exists(chisel3_jar_path):
shutil.copyfile(chisel3_jar.source, chisel3_jar_path)

def dump_default_cfg(self, cfg, dump_name):
shutil.copyfile(args.config, args.dump_name)
Expand Down

0 comments on commit 1d93408

Please sign in to comment.