summaryrefslogtreecommitdiff
path: root/platform/x11
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-02-26 20:25:09 +0100
committerGitHub <noreply@github.com>2017-02-26 20:25:09 +0100
commit7902444f38ebb822ff9f674d1bf62581e08672ec (patch)
tree9f2d679f0579c9fefdd46d5c5d1b8792b5dd6898 /platform/x11
parent8e0dbd1b8e15dc4fb3722f514d2e54bdf2b672d8 (diff)
parentd0c2015fe11f920874661ec24c518aa36c99b470 (diff)
Merge pull request #7834 from hpvb/x11-return-to-cwd-at-exit
X11 return to cwd at exit
Diffstat (limited to 'platform/x11')
-rw-r--r--platform/x11/godot_x11.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/platform/x11/godot_x11.cpp b/platform/x11/godot_x11.cpp
index f85ba17020..b727ecbd17 100644
--- a/platform/x11/godot_x11.cpp
+++ b/platform/x11/godot_x11.cpp
@@ -26,6 +26,9 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#include <unistd.h>
+#include <limits.h>
+
#include "main/main.h"
#include "os_x11.h"
@@ -33,6 +36,9 @@ int main(int argc, char* argv[]) {
OS_X11 os;
+ char *cwd = (char*)malloc(PATH_MAX);
+ getcwd(cwd, PATH_MAX);
+
Error err = Main::setup(argv[0],argc-1,&argv[1]);
if (err!=OK)
return 255;
@@ -41,5 +47,8 @@ int main(int argc, char* argv[]) {
os.run(); // it is actually the OS that decides how to run
Main::cleanup();
+ chdir(cwd);
+ free(cwd);
+
return os.get_exit_code();
}