forked from zilongshanren/programmers-guide
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create script that will generate symlink to cocos2d-x
- Loading branch information
Showing
5 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# Generated | ||
ProgrammerGuideGame/cocos2d | ||
|
||
# Mac system files | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env python | ||
#coding=utf-8 | ||
|
||
import os | ||
import traceback | ||
from optparse import OptionParser | ||
|
||
def main(): | ||
usage = "usage: %prog [options] arg" | ||
parser = OptionParser(usage) | ||
(options, args) = parser.parse_args() | ||
|
||
# TODO: support pass cocos root from args | ||
# if len(args) != 1: | ||
# parser.error('Please specify cocos path') | ||
|
||
# check if cocos2d-x exists | ||
cocos_console_root = os.environ.get('COCOS_CONSOLE_ROOT') | ||
if cocos_console_root is not None: | ||
cocos_root = cocos_console_root | ||
cocos_root = cocos_root.replace('/tools/cocos2d-console/bin','') | ||
|
||
if cocos_root is None: | ||
print('Failed to find cocos2d-x root') | ||
sys.exit(1) | ||
|
||
# create symbolic link to cocos2d-x | ||
os.symlink(cocos_root, 'cocos2d') | ||
|
||
if __name__ == '__main__': | ||
try: | ||
main() | ||
except Exception as e: | ||
traceback.print_exc() | ||
sys.exit(1) |