Skip to content

Commit

Permalink
Add -showPath argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Infocatcher committed Aug 1, 2014
1 parent 313a6d1 commit 9fb6fc1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions openRelativeFile.js
Expand Up @@ -12,6 +12,8 @@

// Usage:
// Call("Scripts::Main", 1, "openRelativeFile.js")
// Also you can use -showPath argument for debug purposes:
// Call("Scripts::Main", 1, "openRelativeFile.js", "-showPath=true")
//===================

//== Settings begin
Expand Down Expand Up @@ -68,6 +70,8 @@ var optionsPath = WScript.ScriptFullName.replace(/(\.[^.]+)?$/, "-options$&");
if(new ActiveXObject("Scripting.FileSystemObject").FileExists(optionsPath))
eval(AkelPad.ReadFile(optionsPath));

var showPath = AkelPad.GetArgValue("showPath", false);

var hMainWnd = AkelPad.GetMainWnd();
var fso = new ActiveXObject("Scripting.FileSystemObject");
var wsh = new ActiveXObject("WScript.Shell");
Expand Down Expand Up @@ -201,6 +205,12 @@ function openRelativePath(relPath, pathStart, pathEnd) {
if(!path)
return false;

if(showPath) {
path = AkelPad.InputBox(hMainWnd, WScript.ScriptName, "Path:", path);
if(!path)
return false;
}

if(pathStart && pathEnd)
AkelPad.SetSel(pathStart, pathEnd);
if(isFileBinary(path)) // Use system association for binary files
Expand Down

0 comments on commit 9fb6fc1

Please sign in to comment.