Question

Dans un fichier script F # (.fsx), comment puis-je déterminer l'emplacement du fichier .fsx en cours d'exécution? Je voudrais chemins de résoudre par rapport à elle.

J'ai essayé Assembly.GetExecutingAssembly().CodeBase mais cela ne fonctionne pas dans une « dynamique assemblée », apparemment.

Était-ce utile?

La solution

extract from F# spec:

__SOURCE_DIRECTORY__ - Replaced by a literal verbatim string that specifies the name of the directory that contains the current file, for example, C:\source. The name of the current file is determined by the most recent line directive in the file. If no line directive has been given, the name is determined by that given to the command-line compiler in combination with System.IO.Path.GetFullPath.

__SOURCE_FILE__ - Replaced by a literal verbatim string that contains the name of the current file, for example, file.fs

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top