Jump to content

File association and working directory

- - - - -

  • Please log in to reply
2 replies to this topic

#1
logicPwn

logicPwn

    Learning Programmer

  • Members
  • PipPipPip
  • 90 posts
I added .cuu file association with my program. One problem is all the Directory.GetCurrentDirectory() calls return where the .cuu file is and not the path to the program.exe. Any work around? I tried Enviroment.CurrentDirectory. Same thing.

#2
gregwarner

gregwarner

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 853 posts
  • Location:Arkansas
The Windows Shell calls (executes) the associated program from within the directory of the double-clicked file, so the current working directory is indeed the directory of your .cuu file.

Edit: You're wanting to know the path to the running executable file, not the current working directory. You might try Application.ExecutablePath. Source: directory - Getting the absolute path of the executable, using C#? - Stack Overflow
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.

– Douglas Hofstadter, Gödel, Escher, Bach: An Eternal Golden Braid


#3
logicPwn

logicPwn

    Learning Programmer

  • Members
  • PipPipPip
  • 90 posts
Thank you. Application.StartupPath and ExecutablePath work perfectly. Just had to convert all my stuff code over to that and now I know from now on. Cheers




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users