Skip to content

Commit 7d45a8a

Browse files
committed
优化SAE引擎创建默认项目, 已存在文件不覆盖
1 parent 82f77ec commit 7d45a8a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?php
2-
function sae_copy_defaut_app($directory,$to) {
2+
function copy_defaut_app($directory,$to) {
33
if(!is_dir($to)){
44
mkdir($to);
55
}
66
$handle = opendir($directory);
77
while (($file = readdir($handle)) !== false) {
8-
if ($file != "." && $file != "..") {
9-
is_dir("$directory/$file") ?sae_copy_defaut_app("$directory/$file","$to/$file") :copy("$directory/$file","$to/$file");
8+
if ($file != '.' && $file != '..') {
9+
if(is_file($to.'/'.$file)) continue;
10+
is_dir($directory.'/'.$file) ?copy_defaut_app($directory.'/'.$file,$to.'/'.$file) :copy($directory.'/'.$file,$to.'/'.$file);
1011
}
1112
}
1213
if (readdir($handle) == false) {
@@ -18,4 +19,4 @@ function sae_copy_defaut_app($directory,$to) {
1819
header("Content-Type:text/html;charset=utf-8");
1920
exit('项目目录不可写,请手动建立项目目录,并设在为可写');
2021
}
21-
sae_copy_defaut_app(SAE_PATH.'DefaultApp/',APP_PATH);
22+
copy_defaut_app(SAE_PATH.'DefaultApp/',APP_PATH);

0 commit comments

Comments
 (0)