strm <<
"Unrecognized file type";
134<<
"CAppRegistry::Find(): no application associated with type " 153 if(
file.empty()) {
161 #elif defined(NCBI_OS_DARWIN) 164OSErr err = FSPathMakeRef((
constUInt8 *)
file.c_str(), &fileRef,
NULL);
166err = LSOpenFSRef(&fileRef,
NULL);
168 return(err == noErr);
173 const string&
prog= ai->GetExePath();
174 const stringapp(
prog+
" "+
file);
183 _TRACE(
Info<<
"CAppPopup::PopupURL: opening URL: "<< url);
193 reinterpret_cast<int>(ShellExecute(
NULL,
201 #elif defined(NCBI_OS_DARWIN) 205CFURLRef urlRef = CFURLCreateWithBytes(kCFAllocatorDefault,
206(
constUInt8 *) url.c_str(),
208kCFStringEncodingMacRoman,
211 constOSErr err = LSOpenCFURLRef(urlRef,
NULL);
212 return(err == noErr);
214 #elif defined(NCBI_OS_UNIX) 219 stringstd_in, std_out, std_err;
223vector<string> programs;
224programs.push_back(
"firefox");
225programs.push_back(
"mozilla");
226programs.push_back(
"netscape");
229args.push_back(
"-remote");
230 stringarg =
"openURL("+ url +
",new-window)";
232 ITERATE(vector<string>, program, programs) {
234std_in, std_out, std_err);
235 if(!exit_status && std_err.empty()) {
240 ITERATE(vector<string>, program, programs) {
244 catch(
conststd::exception&)
class CAppInfo defines an interface for application registration information
class CAppRegistry defines the registry of application information for automated application link-out...
container_type::const_iterator const_iterator
const_iterator end() const
const_iterator find(const key_type &key) const
CNcbiOstream & operator<<(CNcbiOstream &out, const CEquivRange &range)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
void Warning(CExceptionArgs_Base &args)
void Info(CExceptionArgs_Base &args)
static TExitCode System(const char *cmdline)
Execute the specified command.
static CResult SpawnLP(EMode mode, const char *cmdname, const char *argv,...)
Spawn a new process with variable number of command-line arguments and find file to execute from the ...
@ eDetach
Like eNoWait, continues to execute calling process; new process is run in background with no access t...
TAppInfoRef & operator[](const TFileType &type)
filetype::TFileType TFileType
filetype::TFileType TFileType
static int Exec(const string &cmd, const vector< string > &args, const string &std_in, string &std_out, string &std_err, STimeout *timeout=0)
Run an executable using strings for std* .
const string & GetExePath(void) const
static CAppRegistry m_Registry
CAppInfo(const string &path=kEmptyStr)
static bool PopupFile(const string &file, TFileType filetype=filetype::eUnknown)
launch an application to handle a file
const TAppInfoRef & Find(TFileType filetype) const
static bool PopupURL(const string &url)
launch an application to handle a URL
static CAppRegistry & GetRegistry(void)
retrieve the application registry
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Defines a portable execute class.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4