- check if file exists in wxFileConfig::DeleteFile() (Christian Sturmlechner)
- when wxUSE_STL == 1 wxHashTable will not be implemented using wxHashMap
(as in 2.5.0).
+- Added some extra convenience functions to wxRect such as
+ GetBottomRight (Hajo Kirchhoff)
All (GUI):
- MDI child frames are not always resizeable any more (Andrei Fortuna)
- fixed enumerating of entries/groups under '/' in wxRegConfig
- added wxSYS_ICONTITLE_FONT (Andreas Pflug)
+- added wxPATH_NORM_SHORTCUT to wxFileName
wxGTK:
wxPATH_NORM_CASE = 0x0008, // if case insensitive => tolower
wxPATH_NORM_ABSOLUTE = 0x0010, // make the path absolute
wxPATH_NORM_LONG = 0x0020, // make the path the long form
- wxPATH_NORM_ALL = 0x003f & ~wxPATH_NORM_CASE
+ wxPATH_NORM_SHORTCUT = 0x0040, // resolve the shortcut, if it is a shortcut
+ wxPATH_NORM_ALL = 0x00ff & ~wxPATH_NORM_CASE
};
// what exactly should GetPath() return?
{ return Normalize(wxPATH_NORM_DOTS | wxPATH_NORM_ABSOLUTE |
wxPATH_NORM_TILDE, cwd, format); }
+#ifdef __WIN32__
+ // if the path is a shortcut, return the target and optionally,
+ // the arguments
+ bool GetShortcutTarget(const wxString& shortcutPath, wxString& targetFilename, wxString* arguments = NULL);
+#endif
+
// Comparison
// compares with the rules of the given platforms format
m_dirs.Add(dir);
}
+
+#ifdef __WIN32__
+ if ( (flags & wxPATH_NORM_SHORTCUT) )
+ {
+ wxString filename;
+ if (GetShortcutTarget(GetFullPath(format), filename))
+ {
+ // Repeat this since we may now have a new path
+ if ( (flags & wxPATH_NORM_CASE) && !IsCaseSensitive(format) )
+ {
+ filename.MakeLower();
+ }
+ m_relative = false;
+ Assign(filename);
+ }
+ }
+#endif
if ( (flags & wxPATH_NORM_CASE) && !IsCaseSensitive(format) )
{
return true;
}
+// ----------------------------------------------------------------------------
+// get the shortcut target
+// ----------------------------------------------------------------------------
+
+#if defined(__WIN32__) && !defined(__WXWINCE__)
+#include <shlobj.h>
+#endif
+
+#ifdef __WIN32__
+bool wxFileName::GetShortcutTarget(const wxString& shortcutPath, wxString& targetFilename, wxString* arguments)
+{
+#ifdef __WXWINCE__
+ // Not tested on WinCE, so don't compile yet
+ return shortcutPath;
+#else
+ wxString path, file, ext;
+ wxSplitPath(shortcutPath, & path, & file, & ext);
+
+ HRESULT hres;
+ IShellLink* psl;
+ bool success = FALSE;
+
+ // Assume it's not a shortcut if it doesn't end with lnk
+ if (ext.Lower() != wxT("lnk"))
+ return FALSE;
+
+ // create a ShellLink object
+ hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
+ IID_IShellLink, (LPVOID*) &psl);
+
+ if (SUCCEEDED(hres))
+ {
+ IPersistFile* ppf;
+ hres = psl->QueryInterface( IID_IPersistFile, (LPVOID *) &ppf);
+ if (SUCCEEDED(hres))
+ {
+ WORD wsz[MAX_PATH];
+
+ MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, shortcutPath.mb_str(), -1, wsz,
+ MAX_PATH);
+
+ hres = ppf->Load(wsz, 0);
+ if (SUCCEEDED(hres))
+ {
+ wxChar buf[2048];
+ psl->GetPath(buf, 2048, NULL, SLGP_UNCPRIORITY);
+ targetFilename = wxString(buf);
+ success = (shortcutPath != targetFilename);
+
+ psl->GetArguments(buf, 2048);
+ wxString args(buf);
+ if (!args.IsEmpty() && arguments)
+ {
+ *arguments = args;
+ }
+ }
+ }
+ }
+ psl->Release();
+ return success;
+#endif
+}
+#endif
+
+
// ----------------------------------------------------------------------------
// absolute/relative paths
// ----------------------------------------------------------------------------