mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-22 23:06:18 +00:00
Changed: Use std::string instead of const char* for openURL and openDoc
This commit is contained in:
parent
fbac57da97
commit
476ac53605
2 changed files with 6 additions and 6 deletions
|
@ -690,10 +690,10 @@ inline int nlisprint(int c)
|
|||
#endif
|
||||
|
||||
// Open an url in a browser
|
||||
bool openURL (const char *url);
|
||||
bool openURL (const std::string &url);
|
||||
|
||||
// Open a document
|
||||
bool openDoc (const char *document);
|
||||
bool openDoc (const std::string &document);
|
||||
|
||||
// AntiBug method that return an epsilon if x==0, else x
|
||||
inline float favoid0(float x)
|
||||
|
|
|
@ -1434,7 +1434,7 @@ LONG GetRegKey(HKEY key, LPCWSTR subkey, LPWSTR retdata)
|
|||
}
|
||||
#endif // NL_OS_WINDOWS
|
||||
|
||||
static bool openDocWithExtension (const char *document, const char *ext)
|
||||
static bool openDocWithExtension (const std::string &document, const std::string &ext)
|
||||
{
|
||||
#ifdef NL_OS_WINDOWS
|
||||
// First try ShellExecute()
|
||||
|
@ -1552,18 +1552,18 @@ static bool openDocWithExtension (const char *document, const char *ext)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool openURL (const char *url)
|
||||
bool openURL(const std::string &url)
|
||||
{
|
||||
return openDocWithExtension(url, "htm");
|
||||
}
|
||||
|
||||
bool openDoc (const char *document)
|
||||
bool openDoc(const std::string &document)
|
||||
{
|
||||
// get extension from document fullpath
|
||||
string ext = CFile::getExtension(document);
|
||||
|
||||
// try to open document
|
||||
return openDocWithExtension(document, ext.c_str());
|
||||
return openDocWithExtension(document, ext);
|
||||
}
|
||||
|
||||
} // NLMISC
|
||||
|
|
Loading…
Reference in a new issue