DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ Run()

override void OpenDirPlugin::Run ( )
inlineprivate

См. определение в файле OpenDir.c строка 4

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;
20 Workbench.GetCwd(cwd);
21 absPath = cwd + "/" + absPath;
22 }
23
24 int index = absPath.IndexOf("/");
25 int last_index = index;
26
27 while(index != -1)
28 {
29 last_index = index;
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 }
string path
Определения OptionSelectorMultistate.c:142
proto external bool GetCurrentFile(out string filename)
proto native int Length()
Returns length of string.
proto int Replace(string sample, string replace)
Replace all occurrances of 'sample' in 'str' by 'replace'.
proto string Substring(int start, int len)
Substring of 'str' from 'start' position 'len' number of characters.
proto native int IndexOfFrom(int start, string sample)
Finds 'sample' in 'str' from 'start' position. Returns -1 when not found.
proto native int IndexOf(string sample)
Finds 'sample' in 'str'. Returns -1 when not found.
int[] ScriptEditor
Определения workbenchApi.c:2

Перекрестные ссылки Workbench::GetAbsolutePath(), ScriptEditor::GetCurrentFile(), Workbench::GetCwd(), Workbench::GetModule(), string::IndexOf(), string::IndexOfFrom(), string::Length(), path, string::Replace(), Workbench::RunCmd() и string::Substring().