Normal Topic @DirectoryExists problem (Read 1080 times)
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
@DirectoryExists problem
Oct 9th, 2011 at 10:32pm
Print Post Print Post  
Does @DirectoryExists need to be ran from a specific directory or some set path? I have been attempting to check if a specific drive is available p: chr 80 and was not having success. so I tried using the example listed in list browser that should tell me all available drives and it still did not work.

I created a new application with 1 command button with the example code below and it still did not work. I then tried it with using LocalCWD() to bring me to the root directory first, but I still get nothing on any machine I try it with even though I have a c:d:f: and p: drive showing in windows explorer.

Any thoughts on what I am missing?

Thanks


//First Try

var i as Int
var vDrives as String

     For i = 65 to 90
           If @DirectoryExists(@Chr(i) + ":")
           {
                 vDrives = @AppendStringArray(vDrives, @Chr(i))
           }
     Next

     WriteLn("Available Drives:")
     WriteLn(vDrives)


// Second try with LocalCWD()

var i as Int
var vDrives as String


              LocalCWD("c:\")

     For i = 65 to 90
           If @DirectoryExists(@Chr(i) + ":")
           {
                 vDrives = @AppendStringArray(vDrives, @Chr(i))
           }
     Next

                LocalCWD("c:\sesame")
     WriteLn("Available Drives:")
     WriteLn(vDrives)


  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: @DirectoryExists problem
Reply #1 - Oct 10th, 2011 at 1:42am
Print Post Print Post  
Using Windows 7, your first example works for me, except that I get an OS error when it tries to check drive letters for "Removable Disk" drives that don't have anything in them (e.g. SD card reader that has no card in it right now).
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: @DirectoryExists problem
Reply #2 - Oct 10th, 2011 at 3:51am
Print Post Print Post  
Carl,

Thanks for testing the code. I cannot get it to work, so it's nice knowing it is something other than the code. I tried eliminating my Ini file and used the sample ini, but still not working.

I wonder if I am missing something in my include file or if virus protection is interfering. I will turn off virus protection for a moment and look at the different include files.

Thanks again for the help.
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: @DirectoryExists problem
Reply #3 - Oct 10th, 2011 at 11:16pm
Print Post Print Post  
Ok, I have tried everything I can think of. fresh install of sesame and sesame.ini. No Ini, no include. every combination of ini and include. No firewall, No virus protection. I have tried starting Sesame.exe as administrator.

Nothing gives me drive letters with the same code that works for Carl.

What else could possibly be stopping this code from executing properly?

What else should I be looking at?

Thanks
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: @DirectoryExists problem
Reply #4 - Oct 11th, 2011 at 1:13pm
Print Post Print Post  
The code works fine for me on my Windows7 computer. I have not tried it yet on my Windows XP yet.

Bharat
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: @DirectoryExists problem
Reply #5 - Oct 11th, 2011 at 1:23pm
Print Post Print Post  
Between 2.5.2 and 2.5.3 I changed directory exists so that it checks if the path provided as a parameter is actually a directory as opposed to a file. Some versions of windows do not consider: C: or C:\ to be a directory or a file. Others do. I am on Vista and it does not consider either path to be a directory. I am not entirely sure what it considers: C:\ to be, if it is not a directory.

I'll spend today looking for standard library functions on Windows that may behave, you know... standardly.

Robert, in the meantime, you may be able to add an extra backslash to drive specifiers without further path. So if you are testing "C:\" change it to "C:\\".
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged