Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Anyone know of a way to check for valid path?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00192165
Message ID:
00192429
Views:
21
>>Even under Win9x, a folder can be flagged Read-Only (an example would be some of the Windows SpecialFolders such as the FONTS directory) or System, requiring either a special API call to create files in the directories, or that you remove the attribute from the directory hefore copying to it or attempting to create a subdirectory in it.
>>
>
>Ed,
>
>Can you tell me which API function is used for fcreate in windows\system or winnt\system. Or is there a fox command to manipulate dir attributes for specialfolders.

The Windows and Windows\System(32) folders aren't the problem; it's directories like the FONTS or SUBSCRIPTIONS, that have the SYSTEM attribute set that will make life difficult; in some cases, these are virtual directories (Dial-Up Networking, for example), in others (like FONTS) there are specific API calls that write into the directory when registering an appropriate resource file.

You can check the directory's nature with ADIR(); use the template mask 'DSH'. To test the FONTS directory on my NT box:
IF ADIR(aTest,'C:\WINNT\FONTS','DSH') = 1
   * it's there
   IF 'D' $ aTest[1,5]
      *  Congratulations!  It's a directory!
      IF 'S' $ aTest[1,5]
         *  It's a SYSTEM folder!  Bletch!
You can try removing the System attribute using the API call SetFileAttributes(), but I can't guarentee what will happen if you try this on a virtual directory, or on a directory that Windows thinks it should be the only one accessing it directly.

I'd make a backup before I started, and I'd get a good repair tool like ERD Commander Pro in case it falls down and breaks (ERD Commander is a fantastic tool that will let you boot JT from a special set of floppies and repair all kinds of disasters that would otherwise require reinstalling NT at a minimum, or in some cases, going back to square 1 and reinstalling from scratch. It's saved me from my best efforts at doing something really dumb more than once. If you support NT, this is a must have from my POV. It's not cheap at $325; it's paid for itself many times over for me here at home and the office.)

Ed
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform