Early check if output is writable in capture utility.

This commit is contained in:
Bartosz Taudul 2020-09-20 20:11:19 +02:00
parent a1916a7c6c
commit 4a0926aa70

View File

@ -1,5 +1,7 @@
#ifdef _WIN32 #ifdef _WIN32
# include <windows.h> # include <windows.h>
#else
# include <unistd.h>
#endif #endif
#include <chrono> #include <chrono>
@ -79,6 +81,15 @@ int main( int argc, char** argv )
return 4; return 4;
} }
FILE* test = fopen( output, "wb" );
if( !test )
{
printf( "Cannot open output file %s for writing!\n", output );
return 5;
}
fclose( test );
unlink( output );
printf( "Connecting to %s:%i...", address, port ); printf( "Connecting to %s:%i...", address, port );
fflush( stdout ); fflush( stdout );
tracy::Worker worker( address, port ); tracy::Worker worker( address, port );