summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864>2009-08-23 21:50:55 +0000
committercyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864>2009-08-23 21:50:55 +0000
commit4a91b122211495ce9d4b2f2fd9ff77e38221a885 (patch)
tree559ea04861f0e44719e461016f2216cc6eb21b23 /src
parentc15707a0181a8eaebf2458bde11a9232acfb0194 (diff)
Really fix running Anope from another directory besides bin, and also fix running it from bin (apparently gdb makes the 0 argument in main() the full path, but outside gdb it's not the full path).
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2463 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r--src/main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 5fcfe3a1c..4ba42f621 100644
--- a/src/main.c
+++ b/src/main.c
@@ -345,6 +345,8 @@ std::string GetFullProgDir(char *argv0)
}
services_bin = remainder;
+ if (services_bin.substr(0, 2) == "./")
+ services_bin = services_bin.substr(2);
std::string fullpath = static_cast<std::string>(buffer) + "/" + remainder;
std::string::size_type n = fullpath.rfind("/" SERVICES_BIN);
return std::string(fullpath, 0, n);
@@ -390,6 +392,8 @@ int main(int ac, char **av, char **envp)
#endif
binary_dir = GetFullProgDir(av[0]);
+ if (binary_dir[binary_dir.size() - 1] == '.')
+ binary_dir = binary_dir.substr(0, binary_dir.size() - 2);
#ifdef _WIN32
std::string::size_type n = binary_dir.rfind("\\");
services_dir = binary_dir.substr(0, n) + "\\data";