Author: remi
Date: 2008-11-30 12:13:09 +0100 (Sun, 30 Nov 2008)
New Revision: 2930

Modified:
   software_suite_v2/tuxware/fuxusbflasher/trunk/flasher/GUI.pas
Log:
* updated with relative paths

Modified: software_suite_v2/tuxware/fuxusbflasher/trunk/flasher/GUI.pas
===================================================================
--- software_suite_v2/tuxware/fuxusbflasher/trunk/flasher/GUI.pas       
2008-11-30 09:44:03 UTC (rev 2929)
+++ software_suite_v2/tuxware/fuxusbflasher/trunk/flasher/GUI.pas       
2008-11-30 11:13:09 UTC (rev 2930)
@@ -59,8 +59,7 @@
   STR_SUCCESSFULLY_PROG = 'Your dongle is successfully programmed !';
 
 const
-  FUXUSB_FIRMWARE = 'c:/tuxdroid/firmware/fuxusb.hex';
-  FUXRF_FIRMWARE = 'c:/tuxdroid/firmware/fuxrf.hex';
+  TUXDROID_REGISTRY_PATH = 'SOFTWARE\Tuxdroid\TuxdroidSetup';
 
 type
   TForm1 = class(TForm)
@@ -102,7 +101,34 @@
 
 {$R *.dfm}
 
+var
+  tuxdroidPath : string;
+  FUXUSB_FIRMWARE : string;
+  FUXRF_FIRMWARE : string;
+
 {**
+ * Get the Tuxdroid installation path.
+ *}
+function getTuxdroidPath : string;
+begin
+  result := '';
+  with TRegistry.Create do
+    try
+      RootKey := HKEY_LOCAL_MACHINE;
+
+      // From Tuxdroid setup
+      if OpenKey(TUXDROID_REGISTRY_PATH, False) then
+      begin
+        // Get tuxdroid installation path
+        result := ReadString('Install_Dir');
+        CloseKey;
+      end;
+    finally
+      Free;
+    end;
+end;
+
+{**
  * Kill a specific task by its name.
  *}
 function KillTask(ExeFileName: string): Integer;
@@ -150,7 +176,7 @@
       if OpenKey('\Software\Microsoft\Windows\CurrentVersion\Setup', False) 
then
       begin
         lastDriverSourcePath := ReadString('SourcePath');
-        WriteString('SourcePath', 'c:\tuxdroid\bin\fuxusbflasher\driver');
+        WriteString('SourcePath', tuxdroidPath + '\bin\fuxusbflasher\driver');
         CloseKey;
       end;
     finally
@@ -474,4 +500,9 @@
   KillTask('FuxUSBFlasher.exe');
 end;
 
+initialization
+  tuxdroidPath := getTuxdroidPath;
+  FUXUSB_FIRMWARE := getTuxdroidPath + '\firmware\fuxusb.hex';
+  FUXRF_FIRMWARE := getTuxdroidPath + '\firmware\fuxrf.hex';
+
 end.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to