};
+/// Convert a path to or from posix style.
+/// \p p is encoded in local 8bit encoding or utf8.
+/// The result is returned in the same encoding as \p p.
string convert_path(string const & p, PathStyle const & target)
{
char path_buf[PATH_MAX];
path_buf[0] = '\0';
+ // cygwin_conv_to_posix_path and cygwin_conv_to_win32_path do not
+ // care about the encoding.
if (target == posix)
cygwin_conv_to_posix_path(p.c_str(), path_buf);
else
}
+/// Convert a path list to or from posix style.
+/// \p p is encoded in local 8bit encoding or utf8.
+/// The result is returned in the same encoding as \p p.
string convert_path_list(string const & p, PathStyle const & target)
{
if (p.empty())
char * ptr = new char[target_size];
if (ptr) {
+ // FIXME: See comment in convert_path() above
if (target == posix)
cygwin_win32_to_posix_path_list(pc, ptr);
else
}
-docstring internal_path(docstring const & p)
-{
- // FIXME UNICODE
- return from_utf8(convert_path(to_utf8(p), PathStyle(posix)));
-}
-
-
string external_path_list(string const & p)
{
return convert_path_list(p, PathStyle(posix));
{
// reference: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc
// /platform/shell/reference/functions/shellexecute.asp
- string const win_path = convert_path(filename, PathStyle(windows));
+ string const win_path = to_local8bit(from_utf8(convert_path(filename, PathStyle(windows))));
char const * action = (mode == VIEW) ? "open" : "edit";
return reinterpret_cast<int>(ShellExecute(NULL, action,
win_path.c_str(), NULL, NULL, 1)) > 32;
string const fonts_dir = addPath(package().system_support(), "fonts");
for (int i = 0 ; i < num_fonts_truetype ; ++i) {
- string const font_current = convert_path(
+ string const font_current = to_local8bit(from_utf8(convert_path(
addName(fonts_dir, win_fonts_truetype[i] + ".ttf"),
- PathStyle(windows));
+ PathStyle(windows))));
AddFontResource(font_current.c_str());
}
#endif
string const fonts_dir = addPath(package().system_support(), "fonts");
for(int i = 0 ; i < num_fonts_truetype ; ++i) {
- string const font_current = convert_path(
+ string const font_current = to_local8bit(from_utf8(convert_path(
addName(fonts_dir, win_fonts_truetype[i] + ".ttf"),
- PathStyle(windows));
+ PathStyle(windows))));
RemoveFontResource(font_current.c_str());
}
#endif