To get the right directory

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
infratec
Always Here
Always Here
Posts: 7583
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

To get the right directory

Post by infratec »

Hi PB Team,

a liitle trouble with some forum gurus inspired me for the following wishes:
http://www.purebasic.fr/english/viewtop ... 13&t=41477

1. rename GetCurrentDirectory() to GetWorkingDirectory()
2. rename SetCurrentDirectory() to SetWorkingDirectory()
3. add a procedure (or Macro) GetProgramDirectory() (GetPathPart(ProramFilename())

And also give a hint in the help for each command to the other command.

So it is more clear that there is a difference.

Bernd
User avatar
KJ67
Enthusiast
Enthusiast
Posts: 218
Joined: Fri Jun 26, 2009 3:51 pm
Location: Westernmost tip of Norway

Re: To get the right directory

Post by KJ67 »

Or use a personal include file with your own macros, so that you can rename and combine the functions according to your own taste?

Changing the names of functions that has their roots back to the old DOS-days would break many programs that works today...
Not so funny...
The best preparation for tomorrow is doing your best today.
infratec
Always Here
Always Here
Posts: 7583
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: To get the right directory

Post by infratec »

Hi KJ67,

you did not understand the reason for my wishes.
I know now the difference, so this wishes are not for me.

But if someone is new to PB and maybe also to programming, she/he does not know the difference
and so she/he can not write the macros by self.

Maybe 1% of the programs using this procedure, so it is not a big deal to adjust this view programs.
When a new major release of PB is coming out you have to adjust more programs.
(Or did your 3.xx programs work without changes in 4.xx ?)

Bernd
UserOfPure
Enthusiast
Enthusiast
Posts: 469
Joined: Sun Mar 16, 2008 9:18 am

Re: To get the right directory

Post by UserOfPure »

"Current" and "working" directories are NOT the same thing, as explained in the other thread. Also, renaming them to no longer match the Windows API equivalents is not a good idea.

Also, for the macro request, you've just shown with your example above how to do it, so why not just use that? You don't need the team to do it for you, you just did it! :roll:
infratec
Always Here
Always Here
Posts: 7583
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: To get the right directory

Post by infratec »

Hi UserOfPure,

as i already wrote:
It is not for me. It is for new users.

And... think more global:

PB is not dedicated to windows.
Or should I say: hm, this function name is not corresponding to the linux API?

Bernd
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Re: To get the right directory

Post by Kaeru Gaman »

making some ProgramPath() Macro native is not a bad idea.
a lot of beginners and also advance people stumble when they first run into the issue with the current directory.

but the "CurrentDirectory" definitely is an essential term, it's how the API calls it and how it always was called since DOS times,
changing this would not only lead to more confusion, it would simply be wrong.

A hint in the help file that the current directory not necessarily is the exe folder would do it.

[edith]
... so what is the "current" dir called on linux?
oh... and have a nice day.
infratec
Always Here
Always Here
Posts: 7583
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: To get the right directory

Post by infratec »

Hi Kaeru,

I know that you know how it is called in linux. :roll:
For all others:
get_cwd()
What means:
get current working directory

So still: from the linux side of life, I can request that the procedure has to be renamed in

Code: Select all

GetCurrentWorkingDirectory()
:wink: (in words: Just a joke)

Bernd
UserOfPure
Enthusiast
Enthusiast
Posts: 469
Joined: Sun Mar 16, 2008 9:18 am

Re: To get the right directory

Post by UserOfPure »

infratec wrote:GetCurrentWorkingDirectory()
:lol:
Post Reply