CurrentWorkingDirectory in shell

Hi everybody
I’m trying to point my app to a folder whos beside the app itself…and use the path in a shell command
But the result of CurrentWorkingDirectory.shellpath on mac is on “/”
Not very helpful in a shell command
So how can i get the path of a folder in the same folder level of the app
( must be R.S. 2012 2.1 Compliant )
Thank

GetFolderItem("")

Tooo easy … like my nose in middle of my face
Thank you

Uh… That’s not correct.

That gives you the directory where the app is. If the console app is called from another location you’ll get the wrong result.

Try SpecialFolder.CurrentWorkingDirectory.

[quote=208649:@Greg O’Lone]Uh… That’s not correct.

That gives you the directory where the app is. If the console app is called from another location you’ll get the wrong result.

Try SpecialFolder.CurrentWorkingDirectory.[/quote]
Oops - that’s right!

Greg it’s the first thing that i’v try ( wrote in my question )
But on Mac OSX the result is only " / "
Not very helpful in a shell command
Don’t know what you mean by [quote]If the console app is called from another location[/quote]
It’s a desktop app drive by one user
The Simon’s solution work for me…
unless you have another solution to get the app location path ( usable in Shell Command )
Thanks

Just adding a bit :slight_smile:
Use the .ShellPath of the FolderItem to use in a Shell.

Thanks Albin
But it’s the the issue in the discussion
I know how get shellpath from folderitem
Greg seems to have objection to use GetFolderItem("")

[quote=209412:@Denis Despres]Thanks Albin
But it’s the the issue in the discussion
I know how get shellpath from folderitem
Greg seems to have objection to use GetFolderItem("")[/quote]

Greg points out the issue for a Console app.

For a Desktop one, you are probably alright.

Thanks for the precision Michel

Hmm, It returns “/” for me as well and that does not seem right indeed.
The LR says:

I wonder what “usually” means in this context? It seems to always be “/” in both debug and build.

Your original question mentioned Working Directory, and Greg was merely pointing out that working directory is not the same as “next to the app”. If you want next to the app, use GetFolderItem(""). If you want working directory, use SpecialFolder. Just be aware they are not the same thing.

Ok Tim that’s my faulty traduction language from french to english
next to the app mean for me ( in the same folder of the app )
Anyway the result of ( SpecialFolder.CurrentWorkingDirectory.shellpath ) on mac is on “/”
and it’s useless on shell command
Right?

It is useless for your purposes. You do not appear to want the working directory. You want the app directory.

My bad… i thought it was the same thing
But ( IF ) it was really working directory that i want to point
How " / " can be helpful in shell Command
Don’t think that i’m challenging you Tim… I want to learn
Thanks

IF the current working directory is something other than “/”. It can be defined/set in many ways. You’re hitting the default.

Ok thank you for the explanation

In my experience, there is no way to set the Home or working directory in a shell mode 0 or mode 1.

Shell simply does nothing with CD, or Home=

However, the Interactive Shell example does change directory, and pwd does point to the new directory.

The shell inherits the working directory from the app, so it all depends on how you launch the app. But that said, the issue isn’t where the shell gets it’s working directory, because the OP is passing the path to it. He’s getting that path from the APP’s working directory in the first place.

We are happily mixing Console and Desktop here.

A Console app indeed gets its working directory from whatever command environment that launched it.And it in run mode, for instance, that points to the user home directory.

In Desktop app, though, it is less clear. If one launches the Unix executable within the bundle, it works just the same as console.

If one double clicks on the app bundle, then shell to pwd consistently gives /, even after using CD to point to another directory. Except in Mode 2.