appmenus: use os.path.join instead of manual string concatenation

This will ease porting the code to other OSes. Also be consistent with
other parts of the script.
This commit is contained in:
Marek Marczykowski-Górecki 2014-04-19 16:46:49 +02:00
parent ffd8db5d06
commit 5bac404079

View File

@ -222,7 +222,7 @@ def main():
print >> sys.stderr, "--> Got {0} appmenus, storing to disk".format(str(len(new_appmenus))) print >> sys.stderr, "--> Got {0} appmenus, storing to disk".format(str(len(new_appmenus)))
for appmenu_file in new_appmenus.keys(): for appmenu_file in new_appmenus.keys():
if options.verbose: if options.verbose:
if os.path.exists(vm.appmenus_templates_dir + '/' + appmenu_file): if os.path.exists(os.path.join(vm.appmenus_templates_dir, appmenu_file)):
print >> sys.stderr, "---> Updating {0}".format(appmenu_file) print >> sys.stderr, "---> Updating {0}".format(appmenu_file)
else: else:
print >> sys.stderr, "---> Creating {0}".format(appmenu_file) print >> sys.stderr, "---> Creating {0}".format(appmenu_file)
@ -253,7 +253,7 @@ def main():
if not new_appmenus.has_key(appmenu_file): if not new_appmenus.has_key(appmenu_file):
if options.verbose: if options.verbose:
print >> sys.stderr, "---> Removing {0}".format(appmenu_file) print >> sys.stderr, "---> Removing {0}".format(appmenu_file)
os.unlink(vm.appmenus_templates_dir + '/' + appmenu_file) os.unlink(os.path.join(vm.appmenus_templates_dir, appmenu_file))
if isinstance(vm, QubesHVm): if isinstance(vm, QubesHVm):
if not os.path.exists(os.path.join(vm.appmenus_templates_dir, if not os.path.exists(os.path.join(vm.appmenus_templates_dir,