localize main errors
This commit is contained in:
parent
e6966b68a9
commit
1a1b6f99b2
36
src/main.cpp
36
src/main.cpp
|
@ -664,7 +664,7 @@ int main(int argc, char** argv) {
|
||||||
val=argv[i+1];
|
val=argv[i+1];
|
||||||
i++;
|
i++;
|
||||||
} else {
|
} else {
|
||||||
reportError(fmt::sprintf("incomplete param %s.",arg.c_str()));
|
reportError(fmt::sprintf(_("incomplete param %s."),arg.c_str()));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -746,13 +746,13 @@ int main(int argc, char** argv) {
|
||||||
logI("loading module...");
|
logI("loading module...");
|
||||||
FILE* f=ps_fopen(fileName.c_str(),"rb");
|
FILE* f=ps_fopen(fileName.c_str(),"rb");
|
||||||
if (f==NULL) {
|
if (f==NULL) {
|
||||||
reportError(fmt::sprintf("couldn't open file! (%s)",strerror(errno)));
|
reportError(fmt::sprintf(_("couldn't open file! (%s)"),strerror(errno)));
|
||||||
e.everythingOK();
|
e.everythingOK();
|
||||||
finishLogFile();
|
finishLogFile();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (fseek(f,0,SEEK_END)<0) {
|
if (fseek(f,0,SEEK_END)<0) {
|
||||||
reportError(fmt::sprintf("couldn't open file! (couldn't get file size: %s)",strerror(errno)));
|
reportError(fmt::sprintf(_("couldn't open file! (couldn't get file size: %s)"),strerror(errno)));
|
||||||
e.everythingOK();
|
e.everythingOK();
|
||||||
fclose(f);
|
fclose(f);
|
||||||
finishLogFile();
|
finishLogFile();
|
||||||
|
@ -760,7 +760,7 @@ int main(int argc, char** argv) {
|
||||||
}
|
}
|
||||||
ssize_t len=ftell(f);
|
ssize_t len=ftell(f);
|
||||||
if (len==(SIZE_MAX>>1)) {
|
if (len==(SIZE_MAX>>1)) {
|
||||||
reportError(fmt::sprintf("couldn't open file! (couldn't get file length: %s)",strerror(errno)));
|
reportError(fmt::sprintf(_("couldn't open file! (couldn't get file length: %s)"),strerror(errno)));
|
||||||
e.everythingOK();
|
e.everythingOK();
|
||||||
fclose(f);
|
fclose(f);
|
||||||
finishLogFile();
|
finishLogFile();
|
||||||
|
@ -768,9 +768,9 @@ int main(int argc, char** argv) {
|
||||||
}
|
}
|
||||||
if (len<1) {
|
if (len<1) {
|
||||||
if (len==0) {
|
if (len==0) {
|
||||||
reportError("that file is empty!");
|
reportError(_("that file is empty!"));
|
||||||
} else {
|
} else {
|
||||||
reportError(fmt::sprintf("couldn't open file! (tell error: %s)",strerror(errno)));
|
reportError(fmt::sprintf(_("couldn't open file! (tell error: %s)"),strerror(errno)));
|
||||||
}
|
}
|
||||||
e.everythingOK();
|
e.everythingOK();
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
@ -779,7 +779,7 @@ int main(int argc, char** argv) {
|
||||||
}
|
}
|
||||||
unsigned char* file=new unsigned char[len];
|
unsigned char* file=new unsigned char[len];
|
||||||
if (fseek(f,0,SEEK_SET)<0) {
|
if (fseek(f,0,SEEK_SET)<0) {
|
||||||
reportError(fmt::sprintf("couldn't open file! (size error: %s)",strerror(errno)));
|
reportError(fmt::sprintf(_("couldn't open file! (size error: %s)"),strerror(errno)));
|
||||||
e.everythingOK();
|
e.everythingOK();
|
||||||
fclose(f);
|
fclose(f);
|
||||||
delete[] file;
|
delete[] file;
|
||||||
|
@ -787,7 +787,7 @@ int main(int argc, char** argv) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (fread(file,1,(size_t)len,f)!=(size_t)len) {
|
if (fread(file,1,(size_t)len,f)!=(size_t)len) {
|
||||||
reportError(fmt::sprintf("couldn't open file! (read error: %s)",strerror(errno)));
|
reportError(fmt::sprintf(_("couldn't open file! (read error: %s)"),strerror(errno)));
|
||||||
e.everythingOK();
|
e.everythingOK();
|
||||||
fclose(f);
|
fclose(f);
|
||||||
delete[] file;
|
delete[] file;
|
||||||
|
@ -796,7 +796,7 @@ int main(int argc, char** argv) {
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
if (!e.load(file,(size_t)len,fileName.c_str())) {
|
if (!e.load(file,(size_t)len,fileName.c_str())) {
|
||||||
reportError(fmt::sprintf("could not open file! (%s)",e.getLastError()));
|
reportError(fmt::sprintf(_("could not open file! (%s)"),e.getLastError()));
|
||||||
e.everythingOK();
|
e.everythingOK();
|
||||||
finishLogFile();
|
finishLogFile();
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -810,7 +810,7 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
if (!e.init()) {
|
if (!e.init()) {
|
||||||
if (consoleMode) {
|
if (consoleMode) {
|
||||||
reportError("could not initialize engine!");
|
reportError(_("could not initialize engine!"));
|
||||||
finishLogFile();
|
finishLogFile();
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -843,12 +843,12 @@ int main(int argc, char** argv) {
|
||||||
fwrite(w->getFinalBuf(),1,w->size(),f);
|
fwrite(w->getFinalBuf(),1,w->size(),f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
} else {
|
} else {
|
||||||
reportError(fmt::sprintf("could not open file! (%s)",e.getLastError()));
|
reportError(fmt::sprintf(_("could not open file! (%s)"),e.getLastError()));
|
||||||
}
|
}
|
||||||
w->finish();
|
w->finish();
|
||||||
delete w;
|
delete w;
|
||||||
} else {
|
} else {
|
||||||
reportError("could not write command stream!");
|
reportError(_("could not write command stream!"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (vgmOutName!="") {
|
if (vgmOutName!="") {
|
||||||
|
@ -859,12 +859,12 @@ int main(int argc, char** argv) {
|
||||||
fwrite(w->getFinalBuf(),1,w->size(),f);
|
fwrite(w->getFinalBuf(),1,w->size(),f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
} else {
|
} else {
|
||||||
reportError(fmt::sprintf("could not open file! (%s)",e.getLastError()));
|
reportError(fmt::sprintf(_("could not open file! (%s)"),e.getLastError()));
|
||||||
}
|
}
|
||||||
w->finish();
|
w->finish();
|
||||||
delete w;
|
delete w;
|
||||||
} else {
|
} else {
|
||||||
reportError("could not write VGM!");
|
reportError(_("could not write VGM!"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (outName!="") {
|
if (outName!="") {
|
||||||
|
@ -886,11 +886,11 @@ int main(int argc, char** argv) {
|
||||||
}
|
}
|
||||||
cli.bindEngine(&e);
|
cli.bindEngine(&e);
|
||||||
if (!cli.init()) {
|
if (!cli.init()) {
|
||||||
reportError("error while starting CLI!");
|
reportError(_("error while starting CLI!"));
|
||||||
} else {
|
} else {
|
||||||
cliSuccess=true;
|
cliSuccess=true;
|
||||||
}
|
}
|
||||||
logI("playing...");
|
logI(_("playing..."));
|
||||||
e.play();
|
e.play();
|
||||||
if (cliSuccess) {
|
if (cliSuccess) {
|
||||||
cli.loop();
|
cli.loop();
|
||||||
|
@ -931,8 +931,8 @@ int main(int argc, char** argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (displayEngineFailError) {
|
if (displayEngineFailError) {
|
||||||
logE("displaying engine fail error.");
|
logE(_("displaying engine fail error."));
|
||||||
g.showError("error while initializing audio!");
|
g.showError(_("error while initializing audio!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (displayLocaleFailError) {
|
if (displayLocaleFailError) {
|
||||||
|
|
Loading…
Reference in a new issue