PDA

View Full Version : Cannot get the truename of "/System Volume Information".


coroto
01-21-2005, 07:09 PM
Hello,

I was looking at some lisp functions for browsing around the file system on a Windows PC.

When I try something really basic:

(directory "/")

I get the error shown in the title,

LISP error:
Cannot get the truename of "/System Volume Information".

So obviously there is something special going on. Does anyone know about how to browse or inquire around the upper levels of a Windows machine (XP) using LISP and see what drives, etc. are available?

Where I was going with this was to follow on to Claus Brod's nice gbrowser sample code, which shows a full directory, but do one which only shows actual directories and not individual files.

Thanks for any help,

clausb
01-22-2005, 02:01 AM
If I understand this correctly, you want to browse the virtual "My Computer" directory which lists the available drive. If so, I don't think you can get this list using LISP file/directory functions - "My Computer" is a virtual directory which Explorer "makes up" for you; I don't think this is really some place in the filesystem which you can visit and browse. But then, I'm just guessing.

Claus

John van Doorn
01-22-2005, 03:25 PM
Hi Coroto,

The System Volume Information is a hidden directory on Windows XP.
There for you cannot use the directory command, since I couldn't find any lisp function to overcome this problem I've written my own :D

(defun my-directory (dir)
(setf dirlist nil)
(with-open-file (stream (format nil "|dir /b \"~a\"" (sd-convert-filename-to-platform dir)))
(loop while (setf input (read-line stream nil)) do
(setf input (remove #\Return input))
(setf dirlist (nconc dirlist (list(format nil "~A~A" dir input))))
)
)
(values dirlist)
)


For the drive letters there is also no function in LISP to retreive them, but I've written a C++ function for OSDM the create a new function getlogicaldrives :p, if you are interested in the C++ file just let me know.

John

clausb
01-23-2005, 12:50 PM
Here's a VBscript which lists the available drives on the system. Save it to a file called drives.vbs, then run it using "cscript.exe /nologo drives.vbs". This will print the available drives to the console, and you can then read that output from LISP, similar to John's example.


set fs = CreateObject("Scripting.FileSystemObject")
set drives = fs.drives
Dim driveTypes(6)
driveTypes(0)="Unknown"
driveTypes(1)="Removable"
driveTypes(2)="Local Partition"
driveTypes(3)="Network Share"
driveTypes(4)="CD-ROM drive"
driveTypes(5)="RAM Disk"
Dim driveStatus
for each drive in drives
driveStatus = drive.Path & " " & driveTypes(drive.DriveType)
if not drive.IsReady then
driveStatus = driveStatus & " (not ready)"
end if
WScript.Echo(driveStatus)
next


HTH,

Claus

clausb
02-13-2005, 10:18 AM
The macro at http://www.clausbrod.de/Osdm/MacroEnumerateDrives builds on the script posted earlier and shows how to enumerate all drives on a Windows system using a combination of VBScript and LISP.

Cheers,

Claus