0

I have a problem. When I try launch my installed app by external request from a chrome browser. Browser copies the app to

C:\Program Files (x86)\Google\Chrome\Application\43.0.2357.130

and run it from there. It is bad because my programm makes a file and the file can't be read...

Access to the path 'C:\Program Files (x86)\Google\Chrome\Application\43.0.2357.130\lp.pat' is denied.

For example I launch my app by link "myapp://Tag". The "myapp" it's a key in the registry. The "Tag" it's a argument for the command line.

How to make that application to be started from its own directory?

dremerDT
  • 96
  • 3
  • 11
  • 1
    you can't run applications from a browser. think of what would happen if websites could run applications on the computer they are being viewed from. – user1666620 Jul 03 '15 at 15:36
  • Why? I added in the registry a key and by the key I launch my app. For example: myapp://TAG. The tag is sending as parameter in the command line. – dremerDT Jul 03 '15 at 15:43
  • a similar question was asked a few days ago http://stackoverflow.com/a/31003781/1666620 – user1666620 Jul 03 '15 at 15:52
  • Sure it's copied there and it's not its **working directory**? I'd presume Chrome won't pollute his own folder... – Adriano Repetti Jul 03 '15 at 17:35
  • No, when I'm using the Directory.GetCurrentDirectory() function, it return that directory C:\Program Files (x86)\Google\Chrome\Application\43.0.2357.130, but my program directory is the C:\myprogram\ – dremerDT Jul 04 '15 at 07:13
  • Exactly. Working directory is one thing. Installation directory is another. Your program stays in his own directory but it's working directory is chrome one. You can run winword from OpenOffice directory... – Adriano Repetti Jul 04 '15 at 08:51
  • Thank you for explanation of the problem! My problem is solved by using a Assembly.GetExecutingAssembly().Location instead of Directory.GetCurrentDirectory() for making the file. – dremerDT Jul 04 '15 at 13:03

1 Answers1

1

Problem is solved by using a Assembly.GetExecutingAssembly().Location instead of Directory.GetCurrentDirectory() for making the file.


Thanks to Adriano Repetti.

dremerDT
  • 96
  • 3
  • 11