It is currently Mon Aug 19, 2019 3:06 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: [Done] FileSize() fails on network share root
PostPosted: Mon Jul 02, 2018 1:22 pm 
Offline
Addict
Addict
User avatar

Joined: Mon Jun 06, 2005 2:35 pm
Posts: 1212
Location: germany
Hi,

if you do FileSize() on a network share root folder, it returns -1 (not found) instead of -2 (directory).

Code:
; Test this on Windows PB 5.46 LTS
FileName.s = "//192.168.11.4/Public/"
Debug "FileSize: " + Str(FileSize(FileName.s))
Debug "GetFileAttributes: " + Str(GetFileAttributes_(FileName) & #FILE_ATTRIBUTE_DIRECTORY)
 
FileName.s = "//192.168.11.4/Public/Misc/"
Debug "FileSize: " + Str(FileSize(FileName.s))
Debug "GetFileAttributes: " + Str(GetFileAttributes_(FileName) & #FILE_ATTRIBUTE_DIRECTORY)

Result:
FileSize: -1
GetFileAttributes: 16
FileSize: -2
GetFileAttributes: 16

Thus, GetFileAttributes() does correct, FileSize() does not.

Linux is also affected, but GetFileAttributes_() does not work there for confirmation.


Top
 Profile  
Reply with quote  
 Post subject: Re: FileSize() fails on network share root
PostPosted: Tue Jul 03, 2018 10:41 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 07, 2007 3:25 pm
Posts: 3636
Location: Berlin, Germany
I can confirm that finding, using PB 5.70 beta 1 on Windows 10.

However, when the name begins with two backslashes, everything is fine here:
Code:
FileName.s = "\\192.168.11.4/Public/"

_________________
Please excuse my flawed English. My native language is PureBasic.
Search
RSBasic's backups


Top
 Profile  
Reply with quote  
 Post subject: Re: FileSize() fails on network share root
PostPosted: Tue Jul 03, 2018 2:46 pm 
Offline
Addict
Addict
User avatar

Joined: Mon Jun 06, 2005 2:35 pm
Posts: 1212
Location: germany
Hello Little John,

thanks for the confirmation. My tool is cross-platform and I decided to always use / and never \. As it is working for the folder in the store, it seems really a bug to me. Hopefully Fred fixes this also in the 5.46 LTS version!


Top
 Profile  
Reply with quote  
 Post subject: Re: FileSize() fails on network share root
PostPosted: Tue Jul 03, 2018 3:50 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Feb 08, 2014 3:26 pm
Posts: 628
Location: France
This is not a bug. \\ is an (Microsoft and OS/2) UNC (Universal Naming Convention)
( \\serveur_name(or ip)\share_name\[dir] ), not a local directory path

https://en.wikipedia.org/wiki/Path_(computing)#Uniform_Naming_Convention

Not cross-plateform.
ie: unix uses hostname:/directorypath/resource

:wink:

_________________
English is not my native language, I use an online translator


Top
 Profile  
Reply with quote  
 Post subject: Re: FileSize() fails on network share root
PostPosted: Sun Dec 02, 2018 10:21 am 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13611
Location: France
Fixed.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: Denis and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye