• Advertisement
Sign in to follow this  

Files across mapped drives

This topic is 4226 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Say I have a file and it's stored in a remote network location. Something like: \\machine\folder\file.txt But \\machine\folder is mapped to a network drive M:, so the same file could also be accessed as follows: M:\file.txt Now suppose one of the data bundles for my game references this file, and that I'm writing an applet to do some stuff to all my data files if it finds the file in a bundle. But I don't know whether the data bundle will access the file as \\machine\folder\file.txt or M:\file.txt. Without resorting to some kind of text substitution (assume that there are a number of drive mappings, and I also don't want to hardcode the paths as the same situation may arise elsewhere in future), is there any function that will let me check if two different paths actually refer to the same file? ie. something like if ( bothPathsPointToSameFile( path1, path2 ) ) { /*...*/ } This is on a Windows XP system and I'm currently coding in MSVC++. Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by SunTzu
Say I have a file and it's stored in a remote network location. Something like:

\\machine\folder\file.txt

But \\machine\folder is mapped to a network drive M:, so the same file could also be accessed as follows:

M:\file.txt

Now suppose one of the data bundles for my game references this file, and that I'm writing an applet to do some stuff to all my data files if it finds the file in a bundle. But I don't know whether the data bundle will access the file as \\machine\folder\file.txt or M:\file.txt.

Without resorting to some kind of text substitution (assume that there are a number of drive mappings, and I also don't want to hardcode the paths as the same situation may arise elsewhere in future), is there any function that will let me check if two different paths actually refer to the same file? ie. something like

if ( bothPathsPointToSameFile( path1, path2 ) ) { /*...*/ }

This is on a Windows XP system and I'm currently coding in MSVC++.

Thanks in advance.


A Reliable hack could be to check both files' information such as last edited, owner, whether it is hidden, file size.

If both are exactly identical but different files you might have a slight problem, you could always try and open one with exclusive permissions (so no other program can open it) and then attempt to try and open the other. If you cant open the second then they probably are the same file.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement