realbasic-nug
[Top] [All Lists]

Re: Is a volume?

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Is a volume?
From: Charles Yeomans <yeomans at desuetude dot com>
Date: Fri, 31 Dec 2004 14:42:52 -0500
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <77295313041230184029d21765 at mail dot gmail dot com> <ED8B01F8-5AD9-11D9-964A-000393786770 at realsoftware dot com> <p06200701bdfb5318c3ca at [10 dot 0 dot 1 dot 2]>

On Dec 31, 2004, at 2:14 PM, Peter E. Barck wrote:

I believe that if the Parent property is nil, the folderitem is a volume.

On Dec 30, 2004, at 8:40 PM, Dave wrote:

How would I check if a folderitem is a volume?
--
Geoff Perlman
President and CEO
REAL Software, Inc.

I have been using the following simple loop to get a Volume Name. Here "myFolderItem" is the FolderItem where you want to find its root Volume. At the end f1 is the Root Volume FolderItem, which for your home folder is equivalent Volume(0)

  Dim f1, f2 As FolderItem
  f1 = myFolderItem
  Do
    f2 = f1.Parent
    if f2 = Nil Then
      Volume_Name = f1.Name
      exit
    end if
    f1 = f2
  Loop

Let me suggest an even simpler version --

f = myFolderItem
While f.Parent <> nil
  f = f.Parent
Wend
Volume_Name = f.Name
--------------
Charles Yeomans

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>