Index: vws ================================================================== --- vws +++ vws @@ -4,11 +4,10 @@ import fcntl import socket import errno import re import os,sys -config=ConfigParser({"SharedVMs":"/var/cache/vws/shared","AutostartVMs":"/var/cache/vws/auto"}) def find_vm(name): search_path=[os.environ['HOME']+"/VWs", config.get("directories","SharedVMs"), config.get("directories","AutostartVMs")] for dirname in search_path: @@ -106,19 +105,23 @@ raise NotImplementedError def cmd_usb_attached(options): answer=send_command(options.sock,"info usb") print answer def cmd_list(options): + count = 0 search_path=[os.environ['HOME']+"/VWs", config.get("directories","SharedVMs"), config.get("directories","AutostartVMs")] for dirname in search_path: if not os.access(dirname+"/.",os.X_OK): continue for vmname in os.listdir(dirname): if os.access(dirname+"/"+vmname+"/start",os.X_OK): + count += 1 print vmname + if not count: + sys.exit(1) # # Utility functions for arg parsing # def new_command(cmds,name,**kwargs): @@ -133,12 +136,12 @@ # config=ConfigParser({'SharedVMs':'/var/cache/vws/shared', - 'AuthoStartVMs':'/var/cache/vws/autostart'}) - + 'AutoStartVMs':'/var/cache/vws/autostart'}) +config.add_section('directories') config.read(['/etc/vws.conf',os.environ['HOME']+'/.vwsrc']) args=ArgumentParser() cmds=args.add_subparsers(dest='command',help="sub-command help") p=cmds.add_parser("list",help="List existing VWs")