Google グループは Usenet の新規の投稿と購読のサポートを終了しました。過去のコンテンツは引き続き閲覧できます。
Dismiss

How to open folder - Win/Linux/Mac ?

閲覧: 65 回
最初の未読メッセージにスキップ

Aldo Buratti

未読、
2017/03/09 17:38:462017/03/09
To:
At the end of a long computation, I need to show all the results (several files) in a given folder.
On Windows I can do something like this
exec {*}[auto_execok start] c:/tmp
or
exec cmd /C start c:/tmp

What are the equivalent commands for Linux and Mac ?

Aldo

Christian Gollwitzer

未読、
2017/03/10 0:22:542017/03/10
To:
Am 09.03.17 um 23:38 schrieb Aldo Buratti:
Linux: xdg-open
OS X: open

These are the command line tools for running some arbitrary "thing",
from within Tcl you need to prepend with exec, of course.

Christian

Paul Obermeier

未読、
2017/03/10 2:29:352017/03/10
To:
I have this proc in my Tcl swiss-knife:

proc StartFileBrowser { dir } {
if { $::tcl_platform(platform) eq "windows" } {
set browserProg "explorer"
} elseif { $::tcl_platform(os) eq "Linux" } {
set browserProg "konqueror"
} elseif { $::tcl_platform(os) eq "Darwin" } {
set browserProg "open"
} elseif { $::tcl_platform(os) eq "SunOS" } {
set browserProg "filemgr -d"
} elseif { [string match "IRIX*" $::tcl_platform(os)] } {
set browserProg "fm"
} else {
set browserProg "xterm -e ls"
}
if { [file isdirectory $dir] } {
eval exec $browserProg [list [file nativename $dir]] &
}
}

Paul

Ralf Fassel

未読、
2017/03/10 8:08:252017/03/10
To:
* Paul Obermeier <ober...@poSoft.de>
| I have this proc in my Tcl swiss-knife:
>
| proc StartFileBrowser { dir } {
--<snip-snip>--
| } else {
| set browserProg "xterm -e ls"
| }
| if { [file isdirectory $dir] } {
| eval exec $browserProg [list [file nativename $dir]] &
| }
| }

Just out of curiosity: on which platform/universe is
exec xterm -e ls &
useful?

On my Linux system an xterm appears and disappears instantly -
too short for my human eyes to grok... :-)

R'

Rich

未読、
2017/03/10 8:10:202017/03/10
To:
Paul Obermeier <ober...@posoft.de> wrote:
> I have this proc in my Tcl swiss-knife:
>
> proc StartFileBrowser { dir } {
> if { $::tcl_platform(platform) eq "windows" } {
> set browserProg "explorer"
> } elseif { $::tcl_platform(os) eq "Linux" } {
> set browserProg "konqueror"
> } elseif { $::tcl_platform(os) eq "Darwin" } {
> set browserProg "open"
> } elseif { $::tcl_platform(os) eq "SunOS" } {
> set browserProg "filemgr -d"
> } elseif { [string match "IRIX*" $::tcl_platform(os)] } {
> set browserProg "fm"
> } else {
> set browserProg "xterm -e ls"
> }
> if { [file isdirectory $dir] } {
> eval exec $browserProg [list [file nativename $dir]] &
> }
> }

And as an FYI, it would fail on my Slackware systems as there is no
"konqueror" (I purposefully do not install KDE).

Rich

未読、
2017/03/10 8:56:342017/03/10
To:
The -e option tells xterm to execute the command, and when the command
is done, xterm exits. If you want it to hang around, then the command
has to wait for user interaction in some way:

xterm -e bash -c 'ls ; read -p "Press Return" junk'

Christian Gollwitzer

未読、
2017/03/10 13:59:192017/03/10
To:
Am 10.03.17 um 14:07 schrieb Rich:
This is why I proposed xdg-open, which should come with any desktop
environment, since it is part of freedesktop.org
Similar to "start" on Windows and "open" on Darwin, it can "run" all
kinds of "things". Folder paths open a file manager window, URLs open a
browser, files open the associated program, so for instance, you could
play a soundfile with

xdg-open some.mp3
or open a text processor with
xdg-open some-word.docx

Christian

Aldo Buratti

未読、
2017/03/10 17:26:142017/03/10
To:
@Christian
Thank you for the Linux suggestion. I only added "2>/dev/null" in order to discard some diagnostic message

# open folder /tmp
exec xdg-open /tmp 2>/dev/null

Thanks again
Aldo
新着メール 0 件