Page 1 of 1
Determine the type of drive
Posted: Thu Jan 25, 2024 7:10 pm
by RichAlgeni
Is there a way to determine the type of a disk drive on a system? Specifically, I'd like to know if a drive is removable, and a DVD or Blu-ray drive. I am writing a process to convert DVD files to mp4's.
Re: Determine the type of drive
Posted: Thu Jan 25, 2024 11:00 pm
by jacdelad
Re: Determine the type of drive
Posted: Thu Jan 25, 2024 11:10 pm
by RichAlgeni
Thank you!!!
Re: Determine the type of drive
Posted: Fri Jan 26, 2024 1:46 am
by skywalk
Code: Select all
Procedure.i SL_IsLocalDrive(Drive$)
Drive$ = UCase(Left(Drive$, 1))
Protected.i nDrive = RealDriveType_(Asc(Drive$) - 65, 0)
Select nDrive
Case #DRIVE_NO_ROOT_DIR
nDrive = 0
Case #DRIVE_UNKNOWN
ndrive = 0
Case #DRIVE_REMOVABLE
nDrive = 1
Case #DRIVE_FIXED
nDrive = 1
Case #DRIVE_REMOTE
nDrive = 0
Case #DRIVE_CDROM
nDrive = 0
Case #DRIVE_RAMDISK
nDrive = 0 ; Could be -1, if allowing RAM Drives
EndSelect
ProcedureReturn nDrive
EndProcedure
Debug SL_IsLocalDrive("P")
Procedure.s SL_GetLocalDrives()
Protected.i i, ri
Protected.i mask = GetLogicalDrives_()
Protected.s d$, r$
For i = 0 To 31
If mask & (1 << i)
d$ = Chr('A' + i) + ":\"
ri = GetDriveType_(d$)
If ri <> #DRIVE_CDROM And (ri = #DRIVE_FIXED Or ri = #DRIVE_REMOVABLE)
r$ + d$ + #CMA$
EndIf
EndIf
Next i
ProcedureReturn RTrim(r$, #CMA$)
EndProcedure
Debug SL_GetLocalDrives()
Re: Determine the type of drive
Posted: Fri Jan 26, 2024 7:16 pm
by RichAlgeni
So, I really didn't use the code for the disk type, as it really didn't make a difference to what I was trying to accomplish.
This is what I wrote, a process to convert and combine DVD video files, and make one mp4 file.
https://www.purebasic.fr/english/viewtopic.php?t=83429