5 # define WIN32_LEAN_AND_MEAN
13 # include <mach-o/dyld.h>
20 if(value.empty() || tail.empty() || value.size() < tail.size())
25 return value.compare(value.length() - tail.size(), tail.size(), tail) == 0;
33 for(
int i = 0; i < argc; ++i)
38 const size_t pos = arg.find(
'\"');
39 if(pos != TTKString::npos)
41 arg.insert(arg.begin() + pos,
'\\');
55 const size_t pos = filePath.find_last_of(
'\\');
56 if(pos != TTKString::npos)
61 ShellExecuteA(
nullptr,
"open", (filePath + suffix).c_str(), args.c_str(),
nullptr, SW_HIDE);
62 #elif defined __linux__
63 TTKString filePath = get_current_dir_name();
64 if(readlink(
"/proc/self/exe", path,
sizeof(path) - 1) != 0)
67 const size_t pos = filePath.find_last_of(
'/');
68 if(pos != TTKString::npos)
74 system((filePath + suffix +
TTK_SPACE + args).c_str());
75 #elif defined __APPLE__
78 uint32_t
size =
sizeof(path);
79 if(_NSGetExecutablePath(path, &size) == 0)
82 const size_t pos = filePath.find_last_of(
'/');
83 if(pos != TTKString::npos)
92 if(getcwd(cwd,
sizeof(cwd)))
98 system((filePath + suffix +
TTK_SPACE + args).c_str());
TTK_MODULE_EXPORT QString suffix(const QString &name)
The namespace of the application object.
#define TTK_APP_FILE_NAME
void execute(int argc, char **argv) const
#define TTK_SERVICE_RUN_NAME
#define TTK_STR_QUOTES(s)
static bool endWith(const TTKString &value, const TTKString &tail)