2013-03-05 12 views
12

Więc w VCL, należałoby użyć następującego wiersza kodu w celu pobrania ścieżki aplikacji:Uzyskiwanie ścieżka aplikacji w Firemonkey

ExtractFilePath(Application.ExeName) 

Próbowałem to samo Firemokey i zauważyłem, że nazwa_exe nie był już dostępny. Jakiego kodu mogę użyć jako alternatywy?

Odpowiedz

22

Spróbuj użyć ParamStr (0) zamiast Application.ExeName.

1

znalazłem na http://arcana.sivv.com/blog/, można spróbować użyć tego:

X.Env.ExeFilename - Zwraca rzeczywistą nazwę pliku wykonywalnego uruchomiony.

Oto niektóre wyjaśnienie z tego bloga:

X.Env.SearchPath - Returns the currently registered search path on the system. 
X.Env.AppFilename - Returns the "app" name of the application. On OS X this is the application package in which the exe resides. On Windows, this is the name of the folder in which the exe resides. 
X.Env.ExeFilename - Returns the actual filename of the running executable. 
X.Env.AppFolder - Returns the folder path to the executable, stopping at the level of the application package on OSX. 
X.Env.ExeFolder - Returns the full folder path to the executable. 
X.Env.TempFolder - Returns a writable temp folder path that can be used by your application. 
X.Env.HomeFolder - Returns the user's writable home folder. On OS X this equates to /Users/username and on Windows, C:\Users\username\AppData\Roaming or the appropriate path as set on the system. 
+0

W tym celu należy pobrać i używać 'Ape.Utility .CrossPlatform' unit – TridenT

1

Używam

showmessage(System.SysUtils.GetCurrentDir); 

i działa jak czar :)

Powiązane problemy