[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FileGlobalData::SetCWD()



FileGlobalData::SetCWD() seems to have problems. It calls GetCWDPlain()
which returns the path as a char* using a PFile virtual path.

eg it returns c:/some/path as c/some/path

Now can you tell me if c/some/path is absolute or not?

It then calls SetCWD with this string as the path and gets confused.
FileGlobalData::SetCWD calls FileGlobalData::CreateSubDir which fails because
it thinks the path is relative when it is actually absolute.

Why does it get the current directory and then set the
current directory to the current directory? The answer is that SetCWD doesn't 
just set the current working directory. It has other functionality that 
initialises the data in FileGlobalData. This functionality should be moved to a 
separate function.

After looking at the Unix.cpp version of GetCWD it seems that there is a 
problem with the win32.cpp version. I think that GetCWDPlain should return a 
native path. This would even make the function a lot simpler. After making this 
change, we also need to modify SetCWD(const char* Path) to SetCWD(const char* 
path, bool IsNative) so that we can tell it that the path is native. After 
doing this we make it to Step 4 in pfile_basic successfully (ignoring a lot of 
memory warnings) until where both FileGlobalData::DirTree and 
FileGlobalData::current_wd_path seem to have been set to 0xdddddddd - maybe I 
should check out some of those memory warnings one of them complained 
about "damage after block".

Peter
Burns

---------------------------------------------
This message was sent using Endymion MailMan.
http://www.endymion.com/products/mailman/