Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

10
LINES

< > BotCompany Repo | #1009915 // findCmdOnPATH

JavaX fragment (include)

static File findCmdOnPATH(S cmd) {
  S path = System.getenv("PATH");
  L<S> dirs = splitAt(path, File.pathSeparator);
  S c = isWindows() ? addSuffix(cmd, ".exe") : cmd;
  for (S dir : dirs) {
    File f = new File(dir, c);
    if (f.isFile()) ret f;
  }
  null;
}

Author comment

Began life as a copy of #1004457

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1009915
Snippet name: findCmdOnPATH
Eternal ID of this version: #1009915/3
Text MD5: 5aa70b78e6d131591a4e6766ef7d92f5
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-04 15:57:03
Source code size: 273 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 509 / 556
Version history: 2 change(s)
Referenced in: [show references]