Introduce an easily configurable data directory
authorjaviplx <javiplx@gmail.com>
Fri, 8 Oct 2010 22:29:18 +0000 (22:29 +0000)
committerjaviplx <javiplx@gmail.com>
Fri, 8 Oct 2010 22:29:18 +0000 (22:29 +0000)
git-svn-id: file:///svnroot/wifihood/trunk/wifiscanner@31 c51dfc6a-5949-4919-9c8e-f207a149c383

wifimap/wifiscan.py

index 2c28969..e5295fc 100644 (file)
@@ -7,6 +7,9 @@ import gps
 
 import gobject
 
+import os
+home_dir = "/home/user/MyDocs"
+
 class Scanner ( gps.GPSObject ) :
 
     def __init__ ( self , widget=None , ifname="wlan0" ) :
@@ -53,15 +56,15 @@ class Scanner ( gps.GPSObject ) :
             osso.SystemNote(self.osso_context).system_note_infoprint("Found %d APs" % len(scan_out) )
         #    hildon.hildon_banner_show_information( self._parent , "icon_path" , "Found %d APs" % len(scan_out) )
         else :
-            fd = open( "/home/user/MyDocs/wiscan_gui.info" , 'a' )
+            fd = open( os.path.join( home_dir , "wiscan_gui.info" ) , 'a' )
             fd.write( "%s %s%s\n" % ( time.time() , self.gps_info , out_str ) )
             fd.close()
             if self.satellites :
-                loclist = open( "/home/user/MyDocs/location.info" , 'a' )
+                loclist = open( os.path.join( home_dir , "location.info" ) , 'a' )
                 loclist.write ( "%s\n" % ( self.satellites ,) )
                 loclist.close()
             if self.cell_info :
-                celllist = open( "/home/user/MyDocs/cell.info" , 'a' )
+                celllist = open( os.path.join( home_dir , "cell.info" ) , 'a' )
                 celllist.write ( "%s\n" % ( self.cell_info ,) )
                 celllist.close()