Dear list, I have the following sample:
\starttext \startluacode main_file = document.files[1] if file.pathpart(main_file) == "" then main_filename = file.nameonly(main_file) main_filename_win = main_filename else main_filename = file.pathpart(main_file):gsub(io.fileseparator, "/") .. "/" .. file.nameonly(main_file) docx_file = main_filename .. "-file.docx" epub_file = main_filename .. "-file.epub" if os.name == "windows" then main_filename_win = file.pathpart(main_file) .. io.fileseparator .. file.nameonly(main_file) docx_file_win = main_filename_win .. "-file.docx" epub_file_win = main_filename_win .. "-file.epub" end end if os.name=="windows" then context(docx_file_win) os.execute("copy " .. docx_file_win .. " aeae") else context(docx_file) end \stopluacode \stoptext If I run it on Windows, context(docx_file_win) cannot deal with the backslash, so I get: .document-file.docx So it is impossible that os.execute may work with copy. Running it with Linux, I get "./document-file.docx". How can I get the io.fileseparator or escape the backslash in main_filename_win above? Many thanks for your help, Pablo -- http://www.ousia.tk ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________