Add test.exe 'file not found' error for clarity

This commit is contained in:
bnnm 2017-12-03 13:46:13 +01:00
parent 6072d17f50
commit c60efdfbdf

View File

@ -64,6 +64,7 @@ int main(int argc, char ** argv) {
int i,j,k; int i,j,k;
int opt; int opt;
/* config */ /* config */
char * infilename = NULL;
char * outfilename = NULL; char * outfilename = NULL;
char * outfilename_reset = NULL; char * outfilename_reset = NULL;
int ignore_loop = 0; int ignore_loop = 0;
@ -156,6 +157,15 @@ int main(int argc, char ** argv) {
return 1; return 1;
} }
infilename = argv[optind];
#ifdef WIN32
/* make stdout output work with windows */
if (play_sdtout) {
_setmode(fileno(stdout),_O_BINARY);
}
#endif
if (play_forever && !play_sdtout) { if (play_forever && !play_sdtout) {
fprintf(stderr,"A file of infinite size? Not likely.\n"); fprintf(stderr,"A file of infinite size? Not likely.\n");
return 1; return 1;
@ -166,13 +176,6 @@ int main(int argc, char ** argv) {
return 1; return 1;
} }
#ifdef WIN32
/* make stdout output work with windows */
if (play_sdtout) {
_setmode(fileno(stdout),_O_BINARY);
}
#endif
if (ignore_loop && force_loop) { if (ignore_loop && force_loop) {
fprintf(stderr,"-e and -i are incompatible\n"); fprintf(stderr,"-e and -i are incompatible\n");
return 1; return 1;
@ -182,26 +185,28 @@ int main(int argc, char ** argv) {
return 1; return 1;
} }
if (force_loop && really_force_loop) { if (force_loop && really_force_loop) {
fprintf(stderr,"-E and -e are somewhat redundant, are you confused?\n"); fprintf(stderr,"-E and -e are incompatible\n");
return 1; return 1;
} }
/* manually init streamfile to pass the stream index */ /* manually init streamfile to pass the stream index */
{ {
//s = init_vgmstream(argv[optind]); //s = init_vgmstream(infilename);
STREAMFILE *streamFile = open_stdio_streamfile(argv[optind]); STREAMFILE *streamFile = open_stdio_streamfile(infilename);
if (streamFile) { if (!streamFile) {
fprintf(stderr,"file %s not found\n",infilename);
return 1;
}
streamFile->stream_index = stream_index; streamFile->stream_index = stream_index;
vgmstream = init_vgmstream_from_STREAMFILE(streamFile); vgmstream = init_vgmstream_from_STREAMFILE(streamFile);
close_streamfile(streamFile); close_streamfile(streamFile);
}
}
if (!vgmstream) { if (!vgmstream) {
fprintf(stderr,"failed opening %s\n",argv[optind]); fprintf(stderr,"failed opening %s\n",infilename);
return 1; return 1;
} }
}
/* force only if there aren't already loop points */ /* force only if there aren't already loop points */
if (force_loop && !vgmstream->loop_flag) { if (force_loop && !vgmstream->loop_flag) {
@ -274,10 +279,10 @@ int main(int argc, char ** argv) {
printf("set loop=0\n"); printf("set loop=0\n");
} }
else if (print_metaonly) { else if (print_metaonly) {
printf("metadata for %s\n",argv[optind]); printf("metadata for %s\n",infilename);
} }
else { else {
printf("decoding %s\n",argv[optind]); printf("decoding %s\n",infilename);
} }
} }
if (!play_sdtout && !print_adxencd && !print_oggenc && !print_batchvar) { if (!play_sdtout && !print_adxencd && !print_oggenc && !print_batchvar) {