GetDrivePart()

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

GetDrivePart()

Post by IdeasVacuum »

We have GetPathPart(), GetFilePart() and GetExtensionPart().
GetDrivePart() is missing :)
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: GetDrivePart()

Post by Keya »

isnt "Drive:" just a Windows thing though? like would you return /mnt/something on Linux or? another thing to consider is other path formats on Windows like UNC "\\ComputerName\SharedFolder\Resource" or Long UNC "\\?\UNC\ComputerName\SharedFolder\Resource"

btw i wouldn't mind a GetProgramPath(), life's too short for GetPathPart(ProgramFilename()) hehe #mygrowinglistof1stworldproblems
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: GetDrivePart()

Post by Thunder93 »

Old topic, although even older feature request of the same at viewtopic.php?t=30585 by PB Tue Jan 15, 2008. I agree, would be convenient feature to complement the existing filesystem library but I do understand Drive being part of the command name would be misleading under the other OSes. How abouts GetRootPart(), better? :lol:
IdeasVacuum wrote: Fri Jan 27, 2017 7:39 am We have GetPathPart(), GetFilePart() and GetExtensionPart().
GetDrivePart() is missing :)
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Seymour Clufley
Addict
Addict
Posts: 1233
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Re: GetDrivePart()

Post by Seymour Clufley »

+1
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
AZJIO
Addict
Addict
Posts: 1317
Joined: Sun May 14, 2017 1:48 am

Re: GetDrivePart()

Post by AZJIO »

Code: Select all

EnableExplicit
Macro GetDrivePart(s)
	Left(s, 3)
EndMacro 
Define fuf.s = "C:\Windows\System32"
Debug GetDrivePart(fuf)
User avatar
jacdelad
Addict
Addict
Posts: 1431
Joined: Wed Feb 03, 2021 12:46 pm
Location: Planet Riesa
Contact:

Re: GetDrivePart()

Post by jacdelad »

AZJIO wrote: Wed Mar 22, 2023 5:31 pm

Code: Select all

EnableExplicit
Macro GetDrivePart(s)
	Left(s, 3)
EndMacro 
Define fuf.s = "C:\Windows\System32"
Debug GetDrivePart(fuf)
Not for Linux...
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Post Reply