Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 96112f4

Browse files
committed
find app in the same directory as exe when no arguments are given
Fix nwjs#243
1 parent 5210286 commit 96112f4

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/nw_package.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,20 @@ Package::Package()
112112
if (InitFromPath())
113113
return;
114114

115+
self_extract_ = false;
115116
// Then see if we have arguments and extract it.
116117
CommandLine* command_line = CommandLine::ForCurrentProcess();
117118
const CommandLine::StringVector& args = command_line->GetArgs();
118119
if (args.size() > 0) {
119-
self_extract_ = false;
120120
path_ = FilePath(args[0]);
121-
if (InitFromPath())
122-
return;
121+
} else {
122+
// Try to load from the folder where the exe resides
123+
path_ = GetSelfPath().DirName();
123124
}
125+
if (InitFromPath())
126+
return;
124127

125128
// Finally we init with default settings.
126-
self_extract_ = false;
127129
InitWithDefault();
128130
}
129131

0 commit comments

Comments
 (0)