FW: Working directory on Windows
"Bastian Eicher" <[email protected]>
| Newsgroups | gmane.comp.file-systems.zero-install.devel |
|---|---|
| Message-ID | <[email protected]> |
Copy to mailing list for posterity -----Original Message----- From: Bastian Eicher [mailto:[email protected]] Sent: Montag, 11. Mai 2015 18:31 To: 'Yosif Chumpov' Subject: RE: c# dll feed creation Hi Yosif, The function Path.GetFullPath() uses the current working directory as the base directory, not the installation directory the EXE is located in. When double-clicking an EXE the working directory and the installation directory are the same. When using a shortcut the "Start in" property can set the working directory to something different. When Zero Install launches an application that application inherits the working directory Zero Install was started with. You can add <working-dir/> inside your <command> to tell Zero Install to set the working directory to the implementation directory instead. To make the C# code work with any working directory you could use: Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "testFile.xml") Please note that Zero Install cache directories are write-protected. This means that your application will be able to read a testFile.xml included in the ZIP but it will not be able to modify an existing file or create a new one. If the file needs to be modified at runtime the common solution would be to store it in the AppData directory, using something like this: Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Application Data), "MyApp", "testFile.xml") Regards Bastian P.S. Would you mind if I forward this and some of our previous mails to the Zero Install mailing list? That would make my answer publically visible in case anyone else has similar questions. -----Original Message----- From: Yosif Chumpov [mailto:[email protected]] Sent: Montag, 11. Mai 2015 14:53 To: Bastian Eicher Subject: RE: c# dll feed creation Hi Bastian Thank you for your help. Could you help me with another issue with ZeroInstall. I use config xml("testFile.xml") which contains some configuration data for my application. This file is placed in the same directory as the exe file. I use Path.GetFullPath("testFile.xml") a .Net function to get path to this file. Everything works well but when I use ZeroInstall to run my application it looks like this function return ZeroInstall application directory instead of my application directory. Very strange! Please look at attached source code. Is there any way to resolve this issue without to change my source code? Regards, Yosif ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y