Skip to content

Commit

Permalink
Added another MainForm.glade location, Fixed RemoveLastElement function
Browse files Browse the repository at this point in the history
  • Loading branch information
muttleyxd committed Nov 24, 2016
1 parent 72aa32d commit 4040318
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,10 @@ arma3-unix-launcher
/MainForm.glade~
/#MainForm.glade#

#CLion project files
.idea/*

#build dir
build/*
cmake-build-debug/*
cmake-build-release/*
10 changes: 5 additions & 5 deletions Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ namespace Utils

for (int i = 0; i < count; i++)
{
size_t slashPos = s.find("/");
size_t slashPos = s.find("/");
slashPos++;

if (removeSlash || i != count - 1)
slashPos++;

s = s.substr(slashPos);
s = s.substr(slashPos);
}
if (!removeSlash)
s = "/" + s;
reverse(s.begin(), s.end());

return s;
Expand Down
5 changes: 5 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ int main(int argc, char *argv[])
string MainFormPath = "/usr/share/arma3-unix-launcher/MainForm.glade";
if (!Filesystem::FileExists(MainFormPath))
MainFormPath = "MainForm.glade";
if (!Filesystem::FileExists(MainFormPath))
{
string binaryPath = Filesystem::GetSymlinkTarget("/proc/" + to_string(getpid()) + "/exe");
MainFormPath = Utils::RemoveLastElement(binaryPath, false, 2) + "MainForm.glade";
}
#endif

Glib::RefPtr<Gtk::Builder> builder = Gtk::Builder::create_from_file(MainFormPath);
Expand Down

0 comments on commit 4040318

Please sign in to comment.