-
Notifications
You must be signed in to change notification settings - Fork 187
/
convert.php
69 lines (62 loc) · 2.07 KB
/
convert.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
#
# find -type d -maxdepth 1 | grep -v misc | xargs -n 1 php convert.php
#
$curdir = $_SERVER["argv"][1];
$curdir = getcwd() . "/" . rtrim($curdir, "/");
if (!is_dir($curdir)) {
echo "Please specify directory";
}
$newdir = $curdir . "_new";
// $B%G%#%l%/%H%j:o=|!":n@.$7$J$*$7(B
exec("rm -rf $newdir");
makedir($newdir);
chdir($newdir);
// $BI,MW$J%G%#%l%/%H%j$r:n@.(B
makedir(".monaca");
makedir("merges/android");
makedir("merges/ios");
makedir("merges/winrt");
makedir("merges/firefoxos");
makedir("merges/winrt");
makedir("platforms/android");
makedir("platforms/android/res/drawable");
makedir("platforms/android/res/drawable-hdpi");
makedir("platforms/android/res/drawable-ldpi");
makedir("platforms/android/res/drawable-mdpi");
makedir("platforms/android/res/drawable-xhdpi");
makedir("platforms/android/res/drawable-xxhdpi");
makedir("platforms/ios");
makedir("platforms/ios/MonacaApp/Resources/icons");
makedir("platforms/ios/MonacaApp/Resources/splash");
makedir("platforms/winrt");
makedir("platforms/firefoxos");
makedir("platforms/winrt");
makedir("plugins");
makedir("www");
// $B%3%T!<(B
chdir($curdir);
$copy = [
"project_info.json" => ".monaca/project_info.json",
"android/res/" => "platforms/android/res/",
"assets/android/AndroidManifest.xml" => "platforms/android/AndroidManifest.xml",
"assets/android/config.xml" => "platforms/android/config.xml",
"assets/android/splash_default.png" => "platforms/android/splash_default.png",
"assets/iOS/config.xml" => "platforms/ios/config.xml",
"assets/iOS/MonacaSkeleton-Info.plist" => "platforms/ios/MonacaApp-Info.plist",
"assets/www/" => "www/",
"iOS/MonacaSkeleton/Icon*" => "platforms/ios/MonacaApp/Resources/icons/",
"iOS/MonacaSkeleton/Default*" => "platforms/ios/MonacaApp/Resources/splash/",
"winrt/*.png" => "platforms/winrt/",
];
foreach ($copy as $from => $to) {
$command = "rsync -a $curdir/$from $newdir/$to 2>&1";
#echo $command . "\n";
passthru($command);
}
exec("mv $curdir ${curdir}_old");
exec("mv $newdir ${curdir}");
function makedir($dir) {
echo "Mkdir $dir\n";
@mkdir($dir, 0777, true);
}