Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
opendir.c
Go to the documentation of this file.
1
[
WorkbenchPluginAttribute
(
"Open Dir"
,
"Just for testing"
,
"ctrl+-"
,
""
, {
"ScriptEditor"
})]
2
class
OpenDirPlugin
:
WorkbenchPlugin
3
{
4
override
void
Run
()
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
}
44
45
override
void
Configure
()
46
{
47
Workbench
.
ScriptDialog
(
"Configure OpenDir"
,
"Usage: \n$path - will be replaced with file name"
,
this
);
48
}
49
50
[
ButtonAttribute
(
"OK"
)]
51
void
OkButton
() {}
52
}
53
ButtonAttribute
Definition
workbenchapi.c:118
OpenDirPlugin
Definition
opendir.c:3
OpenDirPlugin::Run
override void Run()
Definition
opendir.c:4
OpenDirPlugin::OkButton
void OkButton()
Definition
opendir.c:51
OpenDirPlugin::Configure
override void Configure()
Definition
opendir.c:45
ScriptEditor
Definition
workbenchapi.c:30
ScriptEditor::GetCurrentFile
proto external bool GetCurrentFile(out string filename)
Workbench
Definition
workbenchapi.c:7
Workbench::GetModule
static proto native WBModuleDef GetModule(string type)
Workbench::GetCwd
static proto void GetCwd(out string currentDir)
Workbench::ScriptDialog
static proto int ScriptDialog(string caption, string text, Class data)
Workbench::RunCmd
static proto native int RunCmd(string command, bool wait=false)
Workbench::GetAbsolutePath
static proto bool GetAbsolutePath(string relativePath, out string absPath)
WorkbenchPlugin::WorkbenchPlugin
void WorkbenchPlugin()
WorkbenchPluginAttribute
RestartDayzTool DayZTool WorkbenchPluginAttribute("DayZ Run", "Just for testing", "ctrl+2", "", {"ScriptEditor"})
Definition
dayztools.c:62
string::Substring
proto string Substring(int start, int len)
Substring of 'str' from 'start' position 'len' number of characters.
string::IndexOf
proto native int IndexOf(string sample)
Finds 'sample' in 'str'.
string::IndexOfFrom
proto native int IndexOfFrom(int start, string sample)
Finds 'sample' in 'str' from 'start' position.
string::Replace
proto int Replace(string sample, string replace)
Replace all occurrances of 'sample' in 'str' by 'replace'.
string::Length
proto native int Length()
Returns length of string.
path
string path
Definition
optionselectormultistate.c:142
Games
Dayz
scripts
editor
workbench
opendir.c
Generated by
1.17.0