U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » U++ Library : Other (not classified elsewhere) » Bug? Directoryexists does not recognise directory if...
Bug? Directoryexists does not recognise directory if... [message #44432] Wed, 11 March 2015 19:10 Go to next message
aftershock is currently offline  aftershock
Messages: 143
Registered: May 2008
Experienced Member
Directoryexists does not recognise directory if path contains a separator at the end on Windows.
Bug?


That is why I need to that.
String dir = GetFileDirectory ( filename );

if ( dir.EndsWith ( DIR_SEPS ) )
dir = dir.Left ( dir.GetCount() - 1 );




if ( DirectoryExists ( dir ) )
{



A.
Re: Bug? Directoryexists does not recognise directory if... [message #44435 is a reply to message #44432] Thu, 12 March 2015 08:28 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
aftershock wrote on Wed, 11 March 2015 19:10
Directoryexists does not recognise directory if path contains a separator at the end on Windows.
Bug?


That is why I need to that.
String dir = GetFileDirectory ( filename );

if ( dir.EndsWith ( DIR_SEPS ) )
dir = dir.Left ( dir.GetCount() - 1 );




if ( DirectoryExists ( dir ) )
{



A.


In this case, our behavior is simply the same as the behavior of API we are calling...

My take is that with separator at the end, it is not correct directory path anymore. Win32 API agrees.

Mirek
Re: Bug? Directoryexists does not recognise directory if... [message #44437 is a reply to message #44435] Thu, 12 March 2015 14:05 Go to previous messageGo to next message
aftershock is currently offline  aftershock
Messages: 143
Registered: May 2008
Experienced Member
Does your library agree with itself?


One function returns a "directory" which is not a directory according to another function in your library.
Re: Bug? Directoryexists does not recognise directory if... [message #44468 is a reply to message #44437] Sat, 14 March 2015 19:27 Go to previous message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
aftershock wrote on Thu, 12 March 2015 14:05
Does your library agree with itself?


One function returns a "directory" which is not a directory according to another function in your library.


Good point Smile

Anyway, GetFileDirectory is sort of wrong name, kept (for ages) for backward compatibility. You can use GetFileFolder instead.

Mirek
Previous Topic: rounding to decimals implementation
Next Topic: Is guilock safe?
Goto Forum:
  


Current Time: Tue Apr 28 23:25:55 GMT+2 2026

Total time taken to generate the page: 0.00497 seconds