diff options
Diffstat (limited to 'src/io/sys.cpp')
| -rw-r--r-- | src/io/sys.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/io/sys.cpp b/src/io/sys.cpp index 00f91137e..21ee94ed3 100644 --- a/src/io/sys.cpp +++ b/src/io/sys.cpp @@ -67,6 +67,21 @@ void Inkscape::IO::dump_fopen_call( char const *utf8name, char const *id ) FILE *Inkscape::IO::fopen_utf8name( char const *utf8name, char const *mode ) { FILE* fp = nullptr; + + if (Glib::ustring( utf8name ) == Glib::ustring("-")) { + // user requests to use pipes + + Glib::ustring how( mode ); + if ( how.find("w") != Glib::ustring::npos ) { +#ifdef WIN32 + setmode(fileno(stdout), O_BINARY) +#endif + return stdout; + } else { + return stdin; + } + } + gchar *filename = g_filename_from_utf8( utf8name, -1, nullptr, nullptr, nullptr ); if ( filename ) { @@ -110,6 +125,10 @@ bool Inkscape::IO::file_test( char const *utf8name, GFileTest test ) { bool exists = false; + // in case the file to check is a pipe it doesn't need to exist + if (g_strcmp0(utf8name, "-") == 0 && G_FILE_TEST_IS_REGULAR) + return true; + if ( utf8name ) { gchar *filename = nullptr; if (utf8name && !g_utf8_validate(utf8name, -1, nullptr)) { |
