int __darwin_execvpe(const char *file, char *const argv[], char *const envp[]) { TRACE1(file); const char* path = Darling::findInPath(file); if (!path) { errno = DARWIN_ENOENT; return -1; } if (!MachO::isMachO(path)) { int rv = execv(path, argv); errnoOut(); return rv; } else { argv = Darling::prependLoaderPath(argv, path); int rv = execvpe(getSelfPath(), argv, envp); errnoOut(); delete [] argv; return rv; } }
int __darwin_execv(const char *path, char *const argv[]) { TRACE1(path); path = translatePathCI(path); if (!MachO::isMachO(path)) { int rv = execv(path, argv); errnoOut(); return rv; } else { argv = Darling::prependLoaderPath(argv, path); int rv = execvp(getSelfPath(), argv); // TODO: change to execv? LOG << "Executing with loader at " << getSelfPath() << std::endl; errnoOut(); delete [] argv; return rv; } }
void ConnectedShortcut::connect(const wstring& settingsArgs) { if (isConnected()) return; wstring args = getArguments(); wstring target = CommandLineParser::escapeArgument(getPath()); wstring description = SHORT_APP_NAME L" + " + getDescription(); wstring workingDirectory = getWorkingDirectory(); if (!args.empty()) target.push_back(L' '); if (!settingsArgs.empty() && settingsArgs.back() != L' ') target.insert(target.begin(), L' '); // SetPath seems to change the working directory, too. // We want to keep the original directory, however. m_pLink->SetPath(getSelfPath().data()); m_pLink->SetArguments((settingsArgs + target + args).data()); m_pLink->SetDescription(description.data()); m_pLink->SetWorkingDirectory(workingDirectory.data()); m_isConnectedCachedResult = true; }
bool ConnectedShortcut::computeIsConnected() const { return !getLArgs().empty() && (_tcsicmp(getSelfPath().data(), getPath().data()) == 0); }