Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Mon Oct 14, 2019 6:28 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Network Folderitem does not exist... but it does!
PostPosted: Thu Jan 12, 2012 2:07 am 
Offline

Joined: Wed Mar 25, 2009 4:30 pm
Posts: 245
Location: Alexandria, VA, USA
Hi Everyone,

Here's a weird problem. If I use SelectFolderDialog to select a network folder (\\NETWORK\Shared\, for example) then I receive a folderitem back, but the Exists property is false.

Clearly it does exist because I just clicked on the folder and I can navigate to it.

This does not happen on Mac, only on Windows. Any idea what's going on?

-Mike

Dim dlg as New SelectFolderDialog
Dim f as FolderItem
f=dlg.ShowModal()

if f <> nil then
if f.exists = false then
msgbox "Does not exist"
end if
else
// MsgBox "no file was selected."
end if


Top
 Profile  
Reply with quote  
 Post subject: Re: Network Folderitem does not exist... but it does!
PostPosted: Thu Jan 12, 2012 4:47 am 
Offline

Joined: Mon Jan 09, 2012 10:04 pm
Posts: 5
Mike,

I tried this on my computer with mapped drives and have no issues. Works without a hitch...
running 2011r4

Maarten


Top
 Profile  
Reply with quote  
 Post subject: Re: Network Folderitem does not exist... but it does!
PostPosted: Thu Jan 12, 2012 7:27 am 
Offline
User avatar

Joined: Fri Oct 28, 2005 7:05 am
Posts: 565
Location: Emsworth, UK
See feedback item #7319

UNC paths always return .Exists = false.

I would not hold your breath waiting for a fix, I reported the bug in 2009

I worked around by attempting to open the file and catching the errors. Not pretty but it works.

IIRC .Exists can also cause problems when a mapped drive becomes disconnected.

_________________
Yes it's me in the avatar


Top
 Profile  
Reply with quote  
 Post subject: Re: Network Folderitem does not exist... but it does!
PostPosted: Thu Jan 12, 2012 10:02 am 
Offline

Joined: Wed Mar 25, 2009 4:30 pm
Posts: 245
Location: Alexandria, VA, USA
msssltd wrote:
See feedback item #7319

UNC paths always return .Exists = false.

I would not hold your breath waiting for a fix, I reported the bug in 2009

I worked around by attempting to open the file and catching the errors. Not pretty but it works.

IIRC .Exists can also cause problems when a mapped drive becomes disconnected.


Thanks, that must be the problem. It works fine if the drive is mapped but not with UNC paths, like you said. I'll try making a UNCFileExists function for it.


Top
 Profile  
Reply with quote  
 Post subject: Re: Network Folderitem does not exist... but it does!
PostPosted: Thu Jan 12, 2012 10:28 am 
Offline

Joined: Wed Mar 25, 2009 4:30 pm
Posts: 245
Location: Alexandria, VA, USA
I take that back: it is working with files.

It seems like folders are the problem. Here is my solution, f.ExistsUNC:

Function ExistsUNC(extends f as folderitem) As boolean
'properly checks if a folderitem pointing to a directory with a UNC path exists.
dim f2 as FolderItem

if f <> nil then
#if TargetWin32
if len(f.AbsolutePath) >= 2 then
if left(f.AbsolutePath, 2) = "\\" then
if f.Directory = false then
return f.exists
else
'it's a UNC directory so try to create a child
f2 = f.child("temp.tmp")
if f2 <> nil then
'the UNC directory exists
return true
else
'the UNC directry does not exist
return false
end if
end if
else
return f.exists
end if
else
return f.exists
end if
#else
return f.exists
#endif
else
return false
end if
End Function


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

All times are UTC - 5 hours


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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group