2013-03-05 4 views
12

Quindi, in VCL, si sarebbe utilizzare la seguente riga di codice per recuperare il percorso applicazioni:Ottenere percorso di applicazione in FireMonkey

ExtractFilePath(Application.ExeName) 

ho provato la stessa cosa Firemokey e ho notato che nomeexe non era più disponibile. Quale codice posso usare come alternativa a questo?

risposta

22

Provare a utilizzare ParamStr (0) anziché Application.ExeName.

1

ho trovato su http://arcana.sivv.com/blog/, si può provare utilizzare questo:

X.Env.ExeFilename - Restituisce il nome del file vero e proprio del file eseguibile in esecuzione.

Ecco qualche spiegazione da questo blog:

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

Per questo è necessario ottenere e utilizzare 'Ape.Utility Unità .CrossPlatform' – TridenT

1

sto usando

showmessage(System.SysUtils.GetCurrentDir); 

e funziona come un fascino :)