bennaloz
16th January 2012 10:58 UTC
IfFileExists not working on win 7?
I have to make a backup of a patch. So I check every file of the patch if exists on the current installation and if it exists I save it and if it doesn't exist I write its path in a file.
Anyway I made it on win xp and it works fine but after, when I tried it on win 7 it didn't work. It seems that every file doesn't exist. I checked the correctness of the path and every path is correct but if the file exists it doesn't copy it like I want but it write every path in the file as if the file doesn't exist. What is the problem? or what could be the problem...
bennaloz
Afrow UK
16th January 2012 11:35 UTC
x64 file system redirection comes to mind. What are the paths?
Stu
bennaloz
16th January 2012 12:01 UTC
aaah you're right.Paths of mine are something like C:\programs\... Maybe I have to use $PROGRAMFILES to make it work with all platforms or $PROGRAMFILES32? I'm sorry it was a pretty stupid question I didn't think about the OS because I used in every path the install dir read from the registry. Except 2 paths :weird:
MSG
16th January 2012 12:15 UTC
edit: D'oh, nevermind. ~_~
bennaloz
16th January 2012 12:29 UTC
In general I need to achieve the install directory of an application installed in any pc. I thought to read the install directory from the registry and it could work in every windows OS. But in XP it works and in 7 seems not. Patch files have been extracted in $TEMP\myfolder. Anyway I think I understood what the problem is. I used for some paths C:\programs\myapp\ for XP. But in win 7 I need C:\program files\myapp if it is x32 or C:\program(x86) if it is x64. My application is a x32 application so should I use $PROGRAMFILES32? I hope I was clear in my explanation
bennaloz
16th January 2012 13:10 UTC
Originally posted by MSG
edit: D'oh, nevermind. ~_~
ahah :D ? ~.~
bennaloz
17th January 2012 07:14 UTC
problem solved sorry for the stupid thread. :( :bin:
I simply read from the registry the path of the installation directory and it changes in according to the operating system. I could also use $PROGRAMFILES/$PROGRAMFILES32 that's the same but reading from the RegKey I have the complete path so it's more convenient