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

10
LINES

< > BotCompany Repo | #1009915 // findCmdOnPATH

JavaX fragment (include)

1  
static File findCmdOnPATH(S cmd) {
2  
  S path = System.getenv("PATH");
3  
  L<S> dirs = splitAt(path, File.pathSeparator);
4  
  S c = isWindows() ? addSuffix(cmd, ".exe") : cmd;
5  
  for (S dir : dirs) {
6  
    File f = new File(dir, c);
7  
    if (f.isFile()) ret f;
8  
  }
9  
  null;
10  
}

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: 512 / 561
Version history: 2 change(s)
Referenced in: [show references]