DayZ 1.24
Loading...
Searching...
No Matches
OpenDirPlugin Class Reference
Inheritance diagram for OpenDirPlugin:
[legend]
Collaboration diagram for OpenDirPlugin:
[legend]

Private Member Functions

override void Run ()
 
override void Configure ()
 
void OkButton ()
 

Detailed Description

Definition at line 2 of file OpenDir.c.

Member Function Documentation

◆ Configure()

override void OpenDirPlugin::Configure ( )
inlineprivate

Definition at line 45 of file OpenDir.c.

46 {
47 Workbench.ScriptDialog("Configure OpenDir", "Usage: \n$path - will be replaced with file name", this);
48 }
static proto int ScriptDialog(string caption, string text, Class data)

References Workbench::ScriptDialog().

◆ OkButton()

void OpenDirPlugin::OkButton ( )
inlineprivate

Definition at line 51 of file OpenDir.c.

51{}

◆ Run()

override void OpenDirPlugin::Run ( )
inlineprivate

Definition at line 4 of file OpenDir.c.

5 {
6 ScriptEditor mod = Workbench.GetModule("ScriptEditor");
7 if (mod)
8 {
9 string file;
10 string absPath;
11 if (mod.GetCurrentFile(file) && Workbench.GetAbsolutePath(file, absPath))
12 {
13 if (absPath.Length() < 2) return;
14
15 absPath.Replace("\\", "/");
16
17 if (absPath[1] != ":")
18 {
19 string cwd;
21 absPath = cwd + "/" + absPath;
22 }
23
24 int index = absPath.IndexOf("/");
25 int last_index = index;
26
27 while (index != -1)
28 {
30 index = absPath.IndexOfFrom(last_index + 1, "/");
31 }
32
33 if (last_index == -1) return;
34
35 string path = absPath.Substring(0, last_index);
36 string command;
37 command.Replace("$path", path);
38 //Print(path);
39 //Workbench.RunCmd(command);
40 Workbench.RunCmd("cmd /c \"start " + path + "\"");
41 }
42 }
43 }
static proto native int RunCmd(string command, bool wait=false)
static proto void GetCwd(out string currentDir)
static proto native WBModuleDef GetModule(string type)
static proto bool GetAbsolutePath(string relativePath, out string absPath)

References Workbench::GetAbsolutePath(), Workbench::GetCwd(), Workbench::GetModule(), path, and Workbench::RunCmd().


The documentation for this class was generated from the following file: