Hi
I just updated to the actual cvs version and tried to run my program. It's a simple Win32 command line tool which reads a text file from the same directory called Update.ini.
When I run it with winedbg it opens the app console window and brings me an app error dialog that it can't find the second text file. After tracing with +file,+dosfs it seems that it's only looking in my home dir instead of the dir where the exe is. Is this true?
Note that my fake C-Drive is not below home. But wine is. Does this matter?
My code looks like:
//---------- CStdioFile inifile;
if (!inifile.Open("Update.ini", CFile::modeRead)) { AfxMessageBox("Update.ini not found!"); return 1; } //----------
Not worth mentioning that it works in Windows.
Here's the log.
-- snip some init --
trace:dosfs:DOSFS_DoGetFullPathName passed L"Update.ini" trace:dosfs:DOSFS_GetFullName L"." (last=0) trace:dosfs:DOSFS_GetFullName returning /home/fabi2 = L"Z:\HOME\FABI2" trace:dosfs:DOSFS_DoGetFullPathName got L"Z:\home\fabi2\Update.ini" trace:dosfs:DOSFS_DoGetFullPathName returning L"Z:\home\fabi2\Update.ini" trace:dosfs:DOSFS_GetFullName L"Update.ini" (last=0) trace:dosfs:DOSFS_FindUnixName /home/fabi2,L"Update.ini" trace:dosfs:DOSFS_OpenDir "/home/fabi2" warn:dosfs:DOSFS_FindUnixName L"Update.ini" not found in '/home/fabi2' trace:dosfs:DOSFS_GetFullName returning /home/fabi2/Update.ini = L"Z:\HOME\FABI2\update.ini" trace:dosfs:DOSFS_OpenDir "/home/fabi2" trace:dosfs:DOSFS_MatchLong (L"Update.ini", L".", 0) trace:dosfs:DOSFS_MatchLong (L"Update.ini", L"..", 0) trace:dosfs:DOSFS_MatchLong (L"Update.ini", L".qt", 0) trace:dosfs:DOSFS_MatchLong (L"Update.ini", L".kde", 0) trace:dosfs:DOSFS_MatchLong (L"Update.ini", L".smb", 0) trace:dosfs:DOSFS_MatchLong (L"Update.ini", L".xim", 0) trace:dosfs:DOSFS_MatchLong (L"Update.ini", L".wine", 0) trace:dosfs:DOSFS_MatchLong (L"Update.ini", L".wmrc", 0) trace:dosfs:DOSFS_MatchLong (L"Update.ini", L".bashrc", 0)
.. trying all files here.
trace:file:CreateFileW L"Update.ini" GENERIC_READ OPEN_EXISTING attributes 0x80 trace:dosfs:DOSFS_GetFullName L"Update.ini" (last=1) trace:dosfs:DOSFS_FindUnixName /home/fabi2,L"Update.ini" trace:dosfs:DOSFS_OpenDir "/home/fabi2" warn:dosfs:DOSFS_FindUnixName L"Update.ini" not found in '/home/fabi2' warn:file:CreateFileW Unable to get full filename from L"Update.ini" (GLE 2)
And then my error message box comes up.
Any ideas? Do I need to change the cwd first?
Thanks Fabi
-----Original Message----- From: wine-devel-admin@winehq.org [mailto:wine-devel-admin@winehq.org]On Behalf Of Fabian Cenedese Sent: 05 September 2003 12:36 To: wine-devel@winehq.com Subject: Current Working Dir?
Hi
I just updated to the actual cvs version and tried to run my program. It's a simple Win32 command line tool which reads a text file from the same directory called Update.ini.
Are you running the tool in the same way? If you are now running it with, for example, "wine ../../../tool" then the current directory ("." in the traces) will not be the same directory as the tool.
If that is not the problem then which version of Wine were you running before the update?
Rob
I just updated to the actual cvs version and tried to run my program. It's a simple Win32 command line tool which reads a text file from the same directory called Update.ini.
Are you running the tool in the same way? If you are now running it with, for example, "wine ../../../tool" then the current directory ("." in the traces) will not be the same directory as the tool.
If that is not the problem then which version of Wine were you running before the update?
Well, I don't know if ever ran this program on wine before, but it's a simple command line tool, I didn't imagine any problems no matter if it worked before or not.
I start it with wine c:/path/to/file.exe, so I guess the current working dir can be anything.
I just tried on windows by calling it from the command line in a different directory and guess what: it didn't work either. But that never showed up as this is usually started from the windows explorer.
Mea culpa. I need to fix this prog then to first get the dir of the exe.
Sorry for the noise, but thanks for helping.
bye Fabi
-----Original Message----- From: wine-devel-admin@winehq.org [mailto:wine-devel-admin@winehq.org]On Behalf Of Fabian Cenedese Sent: 05 September 2003 13:39 To: wine-devel@winehq.org Subject: RE: Current Working Dir?
Well, I don't know if ever ran this program on wine before, but it's a simple command line tool, I didn't imagine any problems no matter if it worked before or not.
I start it with wine c:/path/to/file.exe, so I guess the current working dir can be anything.
Yes, this is the point. When a program asks to open "Update.ini" then it looks in the current working directory. Unless the current working directory is the same as the app directory (i.e. the same directory as the file "Update.ini") then it won't find it. This is the same behaviour as on Windows.
I just tried on windows by calling it from the command line in a different directory and guess what: it didn't work either. But that never showed up as this is usually started from the windows explorer.
Exactly, Windows Explorer, by default, sets the current directory to the directory that the app is in.
Mea culpa. I need to fix this prog then to first get the dir of the exe.
No fixing is needed at all. You just need to either "cd /c/path/to" or run wcmd and do "cd \path\to" and then run the program. This is the same behaviour and you would find in cmd on Windows (NT).
Rob
--- Fabian Cenedese Cenedese@indel.ch wrote:
I just updated to the actual cvs version and tried to run my program.
It's
a simple Win32 command line tool which reads a text file from the same directory called Update.ini.
Are you running the tool in the same way? If you are now running it with, for example, "wine ../../../tool" then the current directory ("." in the traces) will not be the same directory as the tool.
If that is not the problem then which version of Wine were you running before the update?
Well, I don't know if ever ran this program on wine before, but it's a simple command line tool, I didn't imagine any problems no matter if it worked before or not.
I start it with wine c:/path/to/file.exe, so I guess the current working dir can be anything.
I just tried on windows by calling it from the command line in a different directory and guess what: it didn't work either. But that never showed up as this is usually started from the windows explorer.
Mea culpa. I need to fix this prog then to first get the dir of the exe.
Well, I can tell you that the reason it didnt work in windows when running from another directory is because the directory that update.ini (or the exe file) is in probably wasnt in your path.. But either way, fixing the program to get the exe's path will take care of it, until you or a user moves the update.ini to somewhere that isnt in your path and isnt the same directory as the exe.. lol
===== Dustin Navea
Minor Contributor, http://www.winehq.com Bugzilla Janitor, http://bugs.winehq.com Network Admin, irc://irc.blynk.net (down)
__________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com
Le ven 05/09/2003 à 15:34, Dustin Navea a écrit :
Well, I can tell you that the reason it didnt work in windows when running from another directory is because the directory that update.ini (or the exe file) is in probably wasnt in your path.. But either way, fixing the program to get the exe's path will take care of it, until you or a user moves the update.ini to somewhere that isnt in your path and isnt the same directory as the exe.. lol
The path (as in %path%) is only for executable files (.bat, .com, .exe, etc.). For data files (such as this update.ini), there was another command to search automatically in multiple directories called append. I'm not aware of an equivalent for Unix.
Vincent
--- Vincent B�ron vberon@mecano.gme.usherb.ca wrote:
Le ven 05/09/2003 � 15:34, Dustin Navea a �crit :
Well, I can tell you that the reason it didnt work in windows when
running
from another directory is because the directory that update.ini (or the
exe
file) is in probably wasnt in your path.. But either way, fixing the
program
to get the exe's path will take care of it, until you or a user moves the update.ini to somewhere that isnt in your path and isnt the same
directory as
the exe.. lol
The path (as in %path%) is only for executable files (.bat, .com, .exe, etc.). For data files (such as this update.ini), there was another command to search automatically in multiple directories called append. I'm not aware of an equivalent for Unix.
That is what I was referring to. AFAICT he was referring to his command line looking something like this:
C:> cd somedir C:\somedir> c:\myprogdir\myprog.exe
and the update.ini was in C:\myprogdir along with myprog.exe.. but the reason that running it like that failed is because C:\myprogdir was not in the %path%, so even tho myprog.exe could be found by the command prompt (because of it being run with the directory specified), myprog.exe was checking the cwd (C:\somedir) instead of C:\myprogdir, and so was unable to fine the update.ini. If you were to do:
C:> set path=%path%;C:\myprogdir C:> cd somedir C:\somedir> C:\myprogdir\myprog.exe
then it would be able to find update.ini because of the way DOS (and therefore windows) works..
when looking for a file, it checks:
current working directory yes ok no %path% %path% yes ok no error (or in some winvers %windir%) certain winvers %windir% yes ok no %systemdir% certain winvers %systemdir% yes ok no error
hope that is understandable.. lol ;)
===== Dustin Navea
Minor Contributor, http://www.winehq.com Bugzilla Janitor, http://bugs.winehq.com Network Admin, irc://irc.blynk.net (down)
__________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com
IMHO this has no reason to work because you add this, or the myprog.exe is bad designed.
note : since 'C:\myprogdir' is in %PATH%, there's no need to write it in the command line.
fine the update.ini. If you were to do:
C:> set path=%path%;C:\myprogdir C:> cd somedir C:\somedir> C:\myprogdir\myprog.exe
then it would be able to find update.ini because of the way DOS (and therefore windows) works..
===== Sylvain Petreolle (spetreolle_at_users_dot_sourceforge_dot_net) ICQ #170597259 Say NO to software patents Dites NON aux brevets logiciels
"What if tomorrow the War could be over ?" Morpheus, in "Reloaded".
___________________________________________________________ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com
--- Sylvain Petreolle spetreolle@yahoo.fr wrote:
IMHO this has no reason to work because you add this, or the myprog.exe is bad designed.
Ack, I just realized that I am wrong... I see what you were saying before, in DOS, you type in an exe and it searches current dir and %PATH%, but if the program is looking for a file, it will only check %PATH% if it is designed to.. In windows, the same applies, except in the case of dll's.. For those, the API takes over and searches current dir, and if not found, then searches %PATH% if it is set, and %WINDIR% and %SYSTEMDIR%
My apologies for not paying attention to what was said before lol..
note : since 'C:\myprogdir' is in %PATH%, there's no need to write it in the command line.
You are right about that, C:\myprogdir isnt needed, I just typed it in anyways ;)
===== Dustin Navea
Minor Contributor, http://www.winehq.com Bugzilla Janitor, http://bugs.winehq.com Network Admin, irc://irc.blynk.net (down)
__________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com
etc.). For data files (such as this update.ini), there was another command to search automatically in multiple directories called append. I'm not aware of an equivalent for Unix.
... and it made users, developers and publishers upset because it almost never worked. :)
===== Sylvain Petreolle (spetreolle_at_users_dot_sourceforge_dot_net) ICQ #170597259 Say NO to software patents Dites NON aux brevets logiciels
"What if tomorrow the War could be over ?" Morpheus, in "Reloaded".
___________________________________________________________ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com