Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Safe way to create a directory
Message
De
08/11/2001 11:38:21
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00578887
Message ID:
00579139
Vues:
20
This message has been marked as a message which has helped to the initial question of the thread.
Nadya,
This is my ready checking routine if would help :
Lparameters tcDriveName
oFS = CREATEOBJECT('Scripting.FileSystemObject')
For each oDrv in oFS.Drives
  If oDrv.DriveLetter = upper(tcDriveName)
    Return oDrv.IsReady
  Endif
Endfor
Return .F.
Cetin

>Based on this message, I've created this program:
>
lparameter tcDrive
>if vartype(m.tcDrive)<>'C' or empty(m.tcDrive)
>   tcDrive = "A:"
>else
>   tcDrive = left(m.tcDrive,2)
>endif
>
>LOCAL oFSO, oDrive
>oFSO = CREATEOBJECT('Scripting.FileSystemObject')
>oDrive = oFSO.GetDrive(m.tcDrive)
>return oDrive.IsReady
>
>And then I tested it for each possible letter. On the letter n: it gaves me Ole Error 0x800a0044: Unknown COM status code.
>
>
>>>Hi everyone,
>>>
>>>I've just thought about something and made a quick test. Usually we have this kind of code:
>>>
if not directory(m.lcDir)
>>>   md (m.lcDir)
>>>endif
>>>
>>>I decided to test it on "a" drive without disk inserted. To my surprise and relief, directory() function works fine.
>>
>>Under Win2K it triggers a system message box with "Cancel", "Try Again" and "Continue" buttons.
>>
>>However, md command gave an error "File Access is denied". So, what do you think, what kind of code would be more correct? (Besides trapping for error, of course).
>>>
>>
>>
>>See Message #320074.
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform