Skip to content

Commit 751afb6

Browse files
author
minggo
committed
Merge pull request cocos2d#142 from natural-law/develop
Solve the error when creating project in the root of disk on windows.
2 parents 728515c + 2a5c316 commit 751afb6

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

plugins/project_new/project_new.py

+10-18
Original file line numberDiff line numberDiff line change
@@ -173,20 +173,6 @@ def run(self, argv, dependencies):
173173
self.parse_args(argv);
174174
self._create_from_cmd()
175175

176-
177-
# ignore files function generator
178-
def _ignorePath(root, ignore_files):
179-
def __ignoref(p, files):
180-
ignore_list = []
181-
for f in files:
182-
for igf in ignore_files:
183-
f1 = os.path.abspath(os.path.join(p, f))
184-
f2 = os.path.abspath(os.path.join(root, igf))
185-
if f1 == f2:
186-
ignore_list.append(f)
187-
return ignore_list
188-
return __ignoref
189-
190176
def replace_string(filepath, src_string, dst_string):
191177
""" From file's content replace specified string
192178
Arg:
@@ -309,10 +295,16 @@ def __init__(self, lang, cocos_root, project_name, project_dir, tp_name, tp_dir,
309295

310296
def cp_self(self, project_dir, exclude_files):
311297
cocos.Logging.info('> Copy template into %s' % project_dir)
312-
src = cocos.add_path_prefix(self.tp_dir)
313-
dst = cocos.add_path_prefix(self.project_dir)
314-
shutil.copytree(src, dst, True,
315-
ignore = _ignorePath(src, exclude_files) )
298+
299+
if not os.path.exists(self.project_dir):
300+
os.makedirs(self.project_dir)
301+
302+
copy_cfg = {
303+
"from" : self.tp_dir,
304+
"to" : self.project_dir,
305+
"exclude" : exclude_files
306+
}
307+
cocos.copy_files_with_config(copy_cfg, self.tp_dir, self.project_dir)
316308

317309

318310
def do_default_step(self):

0 commit comments

Comments
 (0)