Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Cross-platform way of getting list of all drives (A - Z) on a computer?

  1. #1

    Cross-platform way of getting list of all drives on a computer?

    Hi all,
    I was wondering if there is a cross-platform way of getting a list of all drives installed in a computer?

    I know of GetLogicalDriveStrings which returns a list of drive letters, but I am not sure if this is windows only...

    EDIT: How would one do this on a Linux/Mac OSX machine? Those OSs don't use drive letters like Windows, do they?

    cheers,
    Paul
    Last edited by paul_nicholls; 25-07-2011 at 06:58 AM.

  2. #2
    Actually, on this topic - I want to create a simple form in Lazarus that will allow the user to select a drive, then a folder on that drive, and then show all the files in the selected folder.

    I am trying to make a sound preview form that the user can browse for sounds, play one to see if they like it, and then return that filename to the parent form.

    It seems rather easy to do and I could just re-invent the wheel, but thought there might be one already done that I can modify

    EDIT: and I would still like to do this in a cross-platform manner if possible

    cheers,
    Paul
    Last edited by paul_nicholls; 25-07-2011 at 06:46 AM.

  3. #3
    I just looked at how GIMP does it and that seems pretty good


    The Location edit control also directly controls which driver/folder you are - you start typing in that, and it fills with the closest match to date until you select one and press enter to update the files list below...

    It would be great if I could emulate this or do something similar!

    I guess Linux/Mac OSX would have just folder names or similar in the places list instead of drive letters?

    cheers,
    Paul
    Last edited by paul_nicholls; 25-07-2011 at 07:05 AM.

  4. #4
    As far as i know, Windows is the only OS that uses drive letters. In Linux DVD and other drives are something like /mnt/.../ i don't even remember too well.

  5. #5
    Quote Originally Posted by User137 View Post
    As far as i know, Windows is the only OS that uses drive letters. In Linux DVD and other drives are something like /mnt/.../ i don't even remember too well.
    You are right - I remembered the Linux and /mnt, etc. after I did the initial post

    So, I don't suppose you (or anyone else) would have any idea where to start looking to get Linux/Mac OSX drive names on a machine then?

    cheers,
    Paul
    Last edited by paul_nicholls; 25-07-2011 at 11:56 AM.

  6. #6
    Could it be only matter of listing the subdirectories in /mnt?
    Get your fpc4gba copy now!
    Get your fpc4nds copy now!

  7. #7
    PGDCE Developer de_jean_7777's Avatar
    Join Date
    Nov 2006
    Location
    Bosnia and Herzegovina (Herzegovina)
    Posts
    287
    Some temporary drives (usb memory sticks, ...) are also mounter under /media/.
    Existence is pain

  8. #8
    Mac OS X usually mounts drives under /Volumes/.
    Freeze Development | Elysion Game Framework | Twitter: @Stoney_FD
    Check out my new book: Irrlicht 1.7.1 Realtime 3D Engine Beginner's Guide (It's C++ flavored though)

    Programmer: A device for converting coffein into software.

  9. #9
    Thanks all, I will see what I can come up with

    cheers,
    Paul

  10. #10
    Hm, I not sure if I understood correctly. You want the User first select the drive and then the file, right? But what about the ordinary TopenDialog? One can select all drives from within ... and this works on all OSs. But maybe I got something wrong ...

    TOpenDialog.JPG
    Best regards,
    Cybermonkey

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •