]> git.lyx.org Git - lyx.git/blob - src/support/os_win32.cpp
Fix bug #4269
[lyx.git] / src / support / os_win32.cpp
1 /**
2  * \file os_win32.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Ruurd A. Reitsma
7  * \author Claus Hentschel
8  * \author Angus Leeming
9  * \author Enrico Forestieri
10  *
11  * Full author contact details are available in file CREDITS.
12  *
13  * Various OS specific functions
14  */
15
16 #include <config.h>
17
18 #include "LyXRC.h"
19
20 #include "support/os.h"
21 #include "support/os_win32.h"
22
23 #include "support/debug.h"
24 #include "support/environment.h"
25 #include "support/FileName.h"
26 #include "support/gettext.h"
27 #include "support/filetools.h"
28 #include "support/lstrings.h"
29 #include "support/ExceptionMessage.h"
30 #include "support/qstring_helpers.h"
31
32 #include "support/lassert.h"
33
34 #include <cstdlib>
35 #include <vector>
36
37 #include <QString>
38
39 #include <io.h>
40 #include <direct.h> // _getdrive
41 #include <shlobj.h>  // SHGetFolderPath
42 #include <windef.h>
43 #include <shellapi.h>
44 #include <shlwapi.h>
45
46 // Must define SHGFP_TYPE_CURRENT for older versions of MinGW.
47 #if defined(__MINGW32__)  || defined(__CYGWIN__) || defined(__CYGWIN32__)
48 # include <w32api.h>
49 # if __W32API_MAJOR_VERSION < 3 || \
50      __W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION  < 2
51 #  define SHGFP_TYPE_CURRENT 0
52 # endif
53 #endif
54
55 #if !defined(ASSOCF_INIT_IGNOREUNKNOWN) && !defined(__MINGW32__)
56 #define ASSOCF_INIT_IGNOREUNKNOWN 0
57 #endif
58
59 #if defined(__MINGW32__)
60 #include <stdio.h>
61 #endif
62
63 #if defined(_MSC_VER) && (_MSC_VER >= 1900)
64 #else
65 extern "C" {
66 extern void __wgetmainargs(int * argc, wchar_t *** argv, wchar_t *** envp,
67                            int expand_wildcards, int * new_mode);
68 }
69 #endif
70
71 using namespace std;
72
73 namespace lyx {
74
75 void lyx_exit(int);
76
77 namespace support {
78 namespace os {
79
80 namespace {
81
82 int argc_ = 0;
83 wchar_t ** argv_ = 0;
84
85 bool windows_style_tex_paths_ = true;
86
87 string cygdrive = "/cygdrive";
88
89 BOOL terminate_handler(DWORD event)
90 {
91         if (event == CTRL_CLOSE_EVENT
92             || event == CTRL_LOGOFF_EVENT
93             || event == CTRL_SHUTDOWN_EVENT) {
94                 lyx::lyx_exit(1);
95                 return TRUE;
96         }
97         return FALSE;
98 }
99
100 } // namespace
101
102 void init(int argc, char ** argv[])
103 {
104         /* Note from Angus, 17 Jan 2005:
105          *
106          * The code below is taken verbatim from Ruurd's original patch
107          * porting LyX to Win32.
108          *
109          * Windows allows us to define LyX either as a console-based app
110          * or as a GUI-based app. Ruurd decided to define LyX as a
111          * console-based app with a "main" function rather than a "WinMain"
112          * function as the point of entry to the program, but to
113          * immediately close the console window that Windows helpfully
114          * opens for us. Doing so allows the user to see all of LyX's
115          * debug output simply by running LyX from a DOS or MSYS-shell
116          * prompt.
117          *
118          * The alternative approach is to define LyX as a genuine
119          * GUI-based app, with a "WinMain" function as the entry point to the
120          * executable rather than a "main" function, so:
121          *
122          * #if defined (_WIN32)
123          * # define WIN32_LEAN_AND_MEAN
124          * # include <stdlib.h>  // for __argc, __argv
125          * # include <windows.h> // for WinMain
126          * #endif
127          *
128          * // This will require the "-mwindows" flag when linking with
129          * // gcc under MinGW.
130          * // For MSVC, use "/subsystem:windows".
131          * #if defined (_WIN32)
132          * int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
133          * {
134          *     return mymain(__argc, __argv);
135          * }
136          * #endif
137          *
138          * where "mymain" is just a renamed "main".
139          *
140          * However, doing so means that the lyxerr messages would mysteriously
141          * disappear. They could be resurrected with something like:
142          *
143          * #ifdef WIN32
144          *  AllocConsole();
145          *  freopen("conin$","r",stdin);
146          *  freopen("conout$","w",stdout);
147          *  freopen("conout$","w",stderr);
148          * #endif
149          *
150          * This code could be invoked (say) the first time that lyxerr
151          * is called. However, Ruurd has tried this route and found that some
152          * shell scripts failed, for mysterious reasons...
153          *
154          * I've chosen for now, therefore, to simply add Ruurd's original
155          * code as-is. A wrapper program hidecmd.c has been added to
156          * development/Win32 which hides the console window of lyx when
157          * lyx is invoked as a parameter of hidecmd.exe.
158          */
159
160
161         // Remove PYTHONPATH from the environment as it may point to an
162         // external python installation and cause reconfigure failures.
163         unsetEnv("PYTHONPATH");
164
165
166 #if defined(_MSC_VER) && (_MSC_VER >= 1900)
167         // Removing an argument from argv leads to an assertion on Windows
168         // when compiling with MSVC 2015 in debug mode (see bug #10440).
169         // To avoid this we make a copy of the array of pointers.
170         char ** newargv = (char **) malloc((argc + 1) * sizeof(char *));
171         if (newargv) {
172                 memcpy(newargv, *argv, (argc + 1) * sizeof(char *));
173                 *argv = newargv;
174         } else {
175                 lyxerr << "LyX warning: Cannot make a copy of "
176                           "command line arguments!"
177                        << endl;
178         }
179 #endif
180
181
182         // Get the wide program arguments array
183 #if defined(_MSC_VER) && (_MSC_VER >= 1900)
184         argv_ = CommandLineToArgvW(GetCommandLineW(), &argc_);
185 #else
186         wchar_t ** envp = 0;
187         int newmode = 0;
188         __wgetmainargs(&argc_, &argv_, &envp, -1, &newmode);
189 #endif
190         LATTEST(argc == argc_);
191
192         // If Cygwin is detected, query the cygdrive prefix.
193         // The cygdrive prefix is needed for translating windows style paths
194         // to posix style paths in LaTeX files when the Cygwin teTeX is used.
195         int i;
196         HKEY hkey;
197         char buf[MAX_PATH];
198         DWORD bufsize = sizeof(buf);
199         LONG retval = ERROR_FILE_NOT_FOUND;
200         HKEY const mainkey[2] = { HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER };
201         char const * const subkey[2] = {
202                 "Software\\Cygwin\\setup",                         // Cygwin 1.7
203                 "Software\\Cygnus Solutions\\Cygwin\\mounts v2\\/" // Prev. ver.
204         };
205         char const * const valuename[2] = {
206                 "rootdir", // Cygwin 1.7 or later
207                 "native"   // Previous versions
208         };
209         // Check for newer Cygwin versions first, then older ones
210         for (i = 0; i < 2 && retval != ERROR_SUCCESS; ++i) {
211                 for (int k = 0; k < 2 && retval != ERROR_SUCCESS; ++k)
212                         retval = RegOpenKey(mainkey[k], subkey[i], &hkey);
213         }
214         if (retval == ERROR_SUCCESS) {
215                 // Query the Cygwin root directory
216                 retval = RegQueryValueEx(hkey, valuename[i - 1],
217                                 NULL, NULL, (LPBYTE) buf, &bufsize);
218                 RegCloseKey(hkey);
219                 string const mount = string(buf) + "\\bin\\mount.exe";
220                 if (retval == ERROR_SUCCESS && FileName(mount).exists()) {
221                         cmd_ret const p =
222                                 runCommand(mount + " --show-cygdrive-prefix");
223                         // The output of the mount command is as follows:
224                         // Prefix              Type         Flags
225                         // /cygdrive           system       binmode
226                         // So, we use the inner split to pass the second line
227                         // to the outer split which sets cygdrive with its
228                         // contents until the first blank, discarding the
229                         // unneeded return value.
230                         if (p.first != -1 && prefixIs(p.second, "Prefix"))
231                                 split(split(p.second, '\n'), cygdrive, ' ');
232                 }
233         }
234
235         // Catch shutdown events.
236         SetConsoleCtrlHandler((PHANDLER_ROUTINE)terminate_handler, TRUE);
237 }
238
239
240 string utf8_argv(int i)
241 {
242         LASSERT(i < argc_, return "");
243         return fromqstr(QString::fromWCharArray(argv_[i]));
244 }
245
246
247 void remove_internal_args(int i, int num)
248 {
249         argc_ -= num;
250         for (int j = i; j < argc_; ++j)
251                 argv_[j] = argv_[j + num];
252 }
253
254
255 string current_root()
256 {
257         // _getdrive returns the current drive (1=A, 2=B, and so on).
258         char const drive = ::_getdrive() + 'A' - 1;
259         return string(1, drive) + ":/";
260 }
261
262
263 bool isFilesystemCaseSensitive()
264 {
265         return false;
266 }
267
268
269 docstring::size_type common_path(docstring const & p1, docstring const & p2)
270 {
271         size_t i = 0;
272         size_t const p1_len = p1.length();
273         size_t const p2_len = p2.length();
274         while (i < p1_len && i < p2_len && uppercase(p1[i]) == uppercase(p2[i]))
275                 ++i;
276         if ((i < p1_len && i < p2_len)
277             || (i < p1_len && p1[i] != '/' && i == p2_len)
278             || (i < p2_len && p2[i] != '/' && i == p1_len))
279         {
280                 if (i)
281                         --i;     // here was the last match
282                 while (i && p1[i] != '/')
283                         --i;
284         }
285         return i;
286 }
287
288
289 bool path_prefix_is(string const & path, string const & pre)
290 {
291         return path_prefix_is(const_cast<string &>(path), pre, CASE_UNCHANGED);
292 }
293
294
295 bool path_prefix_is(string & path, string const & pre, path_case how)
296 {
297         docstring const p1 = from_utf8(path);
298         docstring const p2 = from_utf8(pre);
299         docstring::size_type const p1_len = p1.length();
300         docstring::size_type const p2_len = p2.length();
301         docstring::size_type common_len = common_path(p1, p2);
302
303         if (p2[p2_len - 1] == '/' && p1_len != p2_len)
304                 ++common_len;
305
306         if (common_len != p2_len)
307                 return false;
308
309         if (how == CASE_ADJUSTED && !prefixIs(path, pre)) {
310                 if (p1_len < common_len)
311                         path = to_utf8(p2.substr(0, p1_len));
312                 else
313                         path = to_utf8(p2 + p1.substr(common_len,
314                                                         p1_len - common_len));
315         }
316
317         return true;
318 }
319
320
321 string external_path(string const & p)
322 {
323         string const dos_path = subst(p, "/", "\\");
324
325         LYXERR(Debug::LATEX, "<Win32 path correction> ["
326                 << p << "]->>[" << dos_path << ']');
327         return dos_path;
328 }
329
330
331 static QString const get_long_path(QString const & short_path)
332 {
333         // GetLongPathNameW needs the path in utf16 encoding.
334         vector<wchar_t> long_path(MAX_PATH);
335         DWORD result = GetLongPathNameW((wchar_t *) short_path.utf16(),
336                                        &long_path[0], long_path.size());
337
338         if (result > long_path.size()) {
339                 long_path.resize(result);
340                 result = GetLongPathNameW((wchar_t *) short_path.utf16(),
341                                          &long_path[0], long_path.size());
342                 LATTEST(result <= long_path.size());
343         }
344
345         return (result == 0) ? short_path : QString::fromWCharArray(&long_path[0]);
346 }
347
348
349 static QString const get_short_path(QString const & long_path, file_access how)
350 {
351         // CreateFileW and GetShortPathNameW need the path in utf16 encoding.
352         if (how == CREATE) {
353                 HANDLE h = CreateFileW((wchar_t *) long_path.utf16(),
354                                 GENERIC_WRITE, 0, NULL, CREATE_NEW,
355                                 FILE_ATTRIBUTE_NORMAL, NULL);
356                 if (h == INVALID_HANDLE_VALUE
357                     && GetLastError() != ERROR_FILE_EXISTS)
358                         return long_path;
359                 CloseHandle(h);
360         }
361         vector<wchar_t> short_path(MAX_PATH);
362         DWORD result = GetShortPathNameW((wchar_t *) long_path.utf16(),
363                                        &short_path[0], short_path.size());
364
365         if (result > short_path.size()) {
366                 short_path.resize(result);
367                 result = GetShortPathNameW((wchar_t *) long_path.utf16(),
368                                          &short_path[0], short_path.size());
369                 LATTEST(result <= short_path.size());
370         }
371
372         return (result == 0) ? long_path : QString::fromWCharArray(&short_path[0]);
373 }
374
375
376 string internal_path(string const & p)
377 {
378         return subst(fromqstr(get_long_path(toqstr(p))), "\\", "/");
379 }
380
381
382 string safe_internal_path(string const & p, file_access how)
383 {
384         return subst(fromqstr(get_short_path(toqstr(p), how)), "\\", "/");
385 }
386
387
388 string external_path_list(string const & p)
389 {
390         return subst(p, '/', '\\');
391 }
392
393
394 string internal_path_list(string const & p)
395 {
396         return subst(p, '\\', '/');
397 }
398
399
400 string latex_path(string const & p)
401 {
402         // We may need a posix style path or a windows style path (depending
403         // on windows_style_tex_paths_), but we use always forward slashes,
404         // since it gets written into a .tex file.
405
406         if (!windows_style_tex_paths_ && FileName::isAbsolute(p)) {
407                 string const drive = p.substr(0, 2);
408                 string const cygprefix = cygdrive + "/" + drive.substr(0, 1);
409                 string const cygpath = subst(subst(p, '\\', '/'), drive, cygprefix);
410                 LYXERR(Debug::LATEX, "<Path correction for LaTeX> ["
411                         << p << "]->>[" << cygpath << ']');
412                 return cygpath;
413         }
414         return subst(p, '\\', '/');
415 }
416
417
418 string latex_path_list(string const & p)
419 {
420         if (p.empty())
421                 return p;
422
423         // We may need a posix style path or a windows style path (depending
424         // on windows_style_tex_paths_), but we use always forward slashes,
425         // since this is standard for all tex engines.
426
427         if (!windows_style_tex_paths_) {
428                 string pathlist;
429                 for (size_t i = 0, k = 0; i != string::npos; k = i) {
430                         i = p.find(';', i);
431                         string path = subst(p.substr(k, i - k), '\\', '/');
432                         if (FileName::isAbsolute(path)) {
433                                 string const drive = path.substr(0, 2);
434                                 string const cygprefix = cygdrive + "/"
435                                                         + drive.substr(0, 1);
436                                 path = subst(path, drive, cygprefix);
437                         }
438                         pathlist += path;
439                         if (i != string::npos) {
440                                 pathlist += ':';
441                                 ++i;
442                         }
443                 }
444                 return pathlist;
445         }
446         return subst(p, '\\', '/');
447 }
448
449
450 bool is_valid_strftime(string const & p)
451 {
452         string::size_type pos = p.find_first_of('%');
453         while (pos != string::npos) {
454                 if (pos + 1 == string::npos)
455                         break;
456                 if (!containsOnly(p.substr(pos + 1, 1),
457                         "aAbBcdfHIjmMpSUwWxXyYzZ%"))
458                         return false;
459                 if (pos + 2 == string::npos)
460                       break;
461                 pos = p.find_first_of('%', pos + 2);
462         }
463         return true;
464 }
465
466
467 // returns a string suitable to be passed to popen when
468 // reading a pipe
469 char const * popen_read_mode()
470 {
471         return "r";
472 }
473
474
475 string const & nulldev()
476 {
477         static string const nulldev_ = "nul";
478         return nulldev_;
479 }
480
481
482 shell_type shell()
483 {
484         return CMD_EXE;
485 }
486
487
488 char path_separator(path_type type)
489 {
490         if (type == TEXENGINE)
491                 return windows_style_tex_paths_ ? ';' : ':';
492
493         return ';';
494 }
495
496
497 void windows_style_tex_paths(bool use_windows_paths)
498 {
499         windows_style_tex_paths_ = use_windows_paths;
500 }
501
502
503 GetFolderPath::GetFolderPath()
504         : folder_module_(0),
505           folder_path_func_(0)
506 {
507         folder_module_ = LoadLibrary("shfolder.dll");
508         if (!folder_module_) {
509                 throw ExceptionMessage(ErrorException, _("System file not found"),
510                         _("Unable to load shfolder.dll\nPlease install."));
511         }
512
513         folder_path_func_ = reinterpret_cast<function_pointer>(::GetProcAddress(folder_module_, "SHGetFolderPathA"));
514         if (folder_path_func_ == 0) {
515                 throw ExceptionMessage(ErrorException, _("System function not found"),
516                         _("Unable to find SHGetFolderPathA in shfolder.dll\n"
517                           "Don't know how to proceed. Sorry."));
518         }
519 }
520
521
522 GetFolderPath::~GetFolderPath()
523 {
524         if (folder_module_)
525                 FreeLibrary(folder_module_);
526 }
527
528
529 // Given a folder ID, returns the folder name (in unix-style format).
530 // Eg CSIDL_PERSONAL -> "C:/Documents and Settings/USERNAME/My Documents"
531 string const GetFolderPath::operator()(folder_id _id) const
532 {
533         char folder_path[MAX_PATH];
534
535         int id = 0;
536         switch (_id) {
537         case PERSONAL:
538                 id = CSIDL_PERSONAL;
539                 break;
540         case APPDATA:
541                 id = CSIDL_APPDATA;
542                 break;
543         default:
544                 LASSERT(false, return string());
545         }
546         HRESULT const result = (folder_path_func_)(0, id, 0,
547                                                    SHGFP_TYPE_CURRENT,
548                                                    folder_path);
549         return (result == 0) ? os::internal_path(to_utf8(from_filesystem8bit(folder_path))) : string();
550 }
551
552
553 bool canAutoOpenFile(string const & ext, auto_open_mode const mode)
554 {
555         if (ext.empty())
556                 return false;
557
558         string const full_ext = "." + ext;
559
560         DWORD bufSize = MAX_PATH + 100;
561         TCHAR buf[MAX_PATH + 100];
562         // reference: http://msdn.microsoft.com/en-us/library/bb773471.aspx
563         char const * action = (mode == VIEW) ? "open" : "edit";
564         return S_OK == AssocQueryString(ASSOCF_INIT_IGNOREUNKNOWN,
565                 ASSOCSTR_EXECUTABLE, full_ext.c_str(), action, buf, &bufSize);
566 }
567
568
569 bool autoOpenFile(string const & filename, auto_open_mode const mode,
570                   string const & path)
571 {
572         string const texinputs = os::latex_path_list(
573                         replaceCurdirPath(path, lyxrc.texinputs_prefix));
574         string const otherinputs = os::latex_path_list(path);
575         string const sep = windows_style_tex_paths_ ? ";" : ":";
576         string const oldtexinputs = getEnv("TEXINPUTS");
577         string const newtexinputs = "." + sep + texinputs + sep + oldtexinputs;
578         string const oldbibinputs = getEnv("BIBINPUTS");
579         string const newbibinputs = "." + sep + otherinputs + sep + oldbibinputs;
580         string const oldbstinputs = getEnv("BSTINPUTS");
581         string const newbstinputs = "." + sep + otherinputs + sep + oldbstinputs;
582         string const oldtexfonts = getEnv("TEXFONTS");
583         string const newtexfonts = "." + sep + otherinputs + sep + oldtexfonts;
584         if (!path.empty() && !lyxrc.texinputs_prefix.empty()) {
585                 setEnv("TEXINPUTS", newtexinputs);
586                 setEnv("BIBINPUTS", newbibinputs);
587                 setEnv("BSTINPUTS", newbstinputs);
588                 setEnv("TEXFONTS", newtexfonts);
589         }
590
591         QString const wname = toqstr(filename);
592
593         // reference: http://msdn.microsoft.com/en-us/library/bb762153.aspx
594         wchar_t const * action = (mode == VIEW) ? L"open" : L"edit";
595         bool success = reinterpret_cast<intptr_t>(ShellExecuteW(NULL, action,
596                         reinterpret_cast<wchar_t const *>(wname.utf16()),
597                         NULL, NULL, 1)) > 32;
598
599         if (!path.empty() && !lyxrc.texinputs_prefix.empty()) {
600                 setEnv("TEXINPUTS", oldtexinputs);
601                 setEnv("BIBINPUTS", oldbibinputs);
602                 setEnv("BSTINPUTS", oldbstinputs);
603                 setEnv("TEXFONTS", oldtexfonts);
604         }
605         return success;
606 }
607
608
609 string real_path(string const & path)
610 {
611         // See http://msdn.microsoft.com/en-us/library/aa366789(VS.85).aspx
612         QString const qpath = get_long_path(toqstr(path));
613         HANDLE hpath = CreateFileW((wchar_t *) qpath.utf16(), GENERIC_READ,
614                                 FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
615
616         if (hpath == INVALID_HANDLE_VALUE) {
617                 // The file cannot be accessed.
618                 return path;
619         }
620
621         // Get the file size.
622         DWORD size_hi = 0;
623         DWORD size_lo = GetFileSize(hpath, &size_hi);
624
625         if (size_lo == 0 && size_hi == 0) {
626                 // A zero-length file cannot be mapped.
627                 CloseHandle(hpath);
628                 return path;
629         }
630
631         // Create a file mapping object.
632         HANDLE hmap = CreateFileMapping(hpath, NULL, PAGE_READONLY, 0, 1, NULL);
633
634         if (!hmap) {
635                 CloseHandle(hpath);
636                 return path;
637         }
638
639         // Create a file mapping to get the file name.
640         void * pmem = MapViewOfFile(hmap, FILE_MAP_READ, 0, 0, 1);
641
642         if (!pmem) {
643                 CloseHandle(hmap);
644                 CloseHandle(hpath);
645                 return path;
646         }
647
648         TCHAR realpath[MAX_PATH + 1];
649
650         if (!GetMappedFileName(GetCurrentProcess(), pmem, realpath, MAX_PATH)) {
651                 UnmapViewOfFile(pmem);
652                 CloseHandle(hmap);
653                 CloseHandle(hpath);
654                 return path;
655         }
656
657         // Translate device name to UNC prefix or drive letters.
658         TCHAR tmpbuf[MAX_PATH] = TEXT("\\Device\\Mup\\");
659         UINT namelen = _tcslen(tmpbuf);
660         if (_tcsnicmp(realpath, tmpbuf, namelen) == 0) {
661                 // UNC path
662                 _snprintf(tmpbuf, MAX_PATH, "\\\\%s", realpath + namelen);
663                 strncpy(realpath, tmpbuf, MAX_PATH);
664                 realpath[MAX_PATH] = '\0';
665         } else if (GetLogicalDriveStrings(MAX_PATH - 1, tmpbuf)) {
666                 // Check whether device name corresponds to some local drive.
667                 TCHAR name[MAX_PATH];
668                 TCHAR drive[3] = TEXT(" :");
669                 bool found = false;
670                 TCHAR * p = tmpbuf;
671                 do {
672                         // Copy the drive letter to the template string
673                         drive[0] = *p;
674                         // Look up each device name
675                         if (QueryDosDevice(drive, name, MAX_PATH)) {
676                                 namelen = _tcslen(name);
677                                 if (namelen < MAX_PATH) {
678                                         found = _tcsnicmp(realpath, name, namelen) == 0;
679                                         if (found) {
680                                                 // Repl. device spec with drive
681                                                 TCHAR tempfile[MAX_PATH];
682                                                 _snprintf(tempfile,
683                                                         MAX_PATH,
684                                                         "%s%s",
685                                                         drive,
686                                                         realpath + namelen);
687                                                 strncpy(realpath,
688                                                         tempfile,
689                                                         MAX_PATH);
690                                                 realpath[MAX_PATH] = '\0';
691                                         }
692                                 }
693                         }
694                         // Advance p to the next NULL character.
695                         while (*p++) ;
696                 } while (!found && *p);
697         }
698         UnmapViewOfFile(pmem);
699         CloseHandle(hmap);
700         CloseHandle(hpath);
701         string const retpath = subst(string(realpath), '\\', '/');
702         return FileName::fromFilesystemEncoding(retpath).absFileName();
703 }
704
705 } // namespace os
706 } // namespace support
707 } // namespace lyx