diff --git a/IntFunc.cpp b/IntFunc.cpp index 9b0472e..da046d8 100644 --- a/IntFunc.cpp +++ b/IntFunc.cpp @@ -406,9 +406,13 @@ TValue *map_fclose(void *node, TArgs *args, Context &context) { } TValue *map_project_dir(void *node, TArgs *args, Context &context) { - char *s = cgt->ReadStrParam(PARAM_PROJECT_NAME, context.element); + char *s = cgt->ReadStrParam(PARAM_PROJECT_PATH, context.element); std::string p(s); +#ifdef WIN32 + int pos = p.find_last_of('\\'); +#else int pos = p.find_last_of('/'); +#endif TValue *val = new TValue(p.substr(0, pos+1).c_str(), true); delete[] s; return val; @@ -417,8 +421,13 @@ TValue *map_project_dir(void *node, TArgs *args, Context &context) { TValue *map_project_name(void *node, TArgs *args, Context &context) { char *s = cgt->ReadStrParam(PARAM_PROJECT_NAME, context.element); std::string p(s); +#ifdef WIN32 + int pos = p.find_last_of('\\'); + TValue *val = new TValue(p.substr(pos + 1, p.length() - pos).c_str(), true); +#else int pos = p.find_last_of('/'); TValue *val = new TValue(p.substr(pos + 1, p.length() - pos - 5).c_str(), true); +#endif delete[] s; return val; }