CC-2584: airtime-import fails

- fixed relative path problem
- handle the case where file name contains '-'
This commit is contained in:
james 2011-07-22 16:24:31 -04:00
parent a84cb7fc37
commit ccdb886b9a
2 changed files with 13 additions and 2 deletions

View file

@ -33,6 +33,10 @@ api_client = api_client.api_client_factory(config)
# flag should be 'copy' or 'move'
def copy_or_move_files_to(paths, dest, flag):
for path in paths:
if (path[0] == "/" or path[0] == "~"):
path = os.path.realpath(path)
else:
path = currentDir+path
if(os.path.exists(path)):
if(os.path.isdir(path)):
path = format_dir_string(path)
@ -73,7 +77,7 @@ def helper_get_stor_dir():
def checkOtherOption(args):
for i in args:
if('-' in i):
if(i[0] == '-'):
return True
def errorIfMultipleOption(args, msg=''):
@ -243,6 +247,11 @@ parser.add_option('--storage-dir-set', action='callback', callback=StorageSetAct
parser.add_option('--storage-dir-get', action='callback', callback=StorageGetAction, help='Show the current storage dir.')
parser.add_option('-h', '--help', dest='help', action='store_true', help='show this help message and exit')
# pop "--dir"
sys.argv.pop(1)
# pop "invoked pwd"
currentDir = sys.argv.pop(1)+'/'
if('-l' in sys.argv or '--link' in sys.argv):
print "\nThe [-l][--link] option is deprecated. Please use the --watch-add option.\nTry 'airtime-import -h' for more detail.\n"
sys.exit()