changeset 346:a7de2c30336c

Correctly get the path of the application on MacOSX. git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@570 59b1889a-e5ac-428c-b0c7-476e01d41282
author thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
date Sun, 13 Jan 2008 18:51:29 +0000
parents 21a5739fac59
children 1afa67dbecc0
files src/mainwindow.cpp
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/mainwindow.cpp	Sat Jan 12 19:30:57 2008 +0000
+++ b/src/mainwindow.cpp	Sun Jan 13 18:51:29 2008 +0000
@@ -48,8 +48,10 @@
 	// to the applications (.app) path. So get the .apps path here.
     int indexOfDotApp = applicationBinaryPath.indexOf(".app");
     if ( indexOfDotApp != -1 ) {
-	    //TODO: go back to next slash and not only substract 19, which is the length of "UniversalIndentGUI"
-	    applicationBinaryPath = applicationBinaryPath.left( indexOfDotApp-19 );
+		// Cut off after the dot of ".app".
+	    applicationBinaryPath = applicationBinaryPath.left( indexOfDotApp-1 );
+		// Cut off after the first slash that was in front of ".app" (noramlly this is the word "UniversalIndentGUI")
+	    applicationBinaryPath = applicationBinaryPath.left( applicationBinaryPath.lastIndexOf("/") );
 	}
 	QMessageBox::warning(this, "", "Applicationpath =" + applicationBinaryPath);
 #endif