Skip to content

Commit

Permalink
Portability issues with the java viewer
Browse files Browse the repository at this point in the history
git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@182 d0cd1f9f-072b-0410-8dd7-cf729c803f20
  • Loading branch information
theraysmith committed Aug 14, 2008
1 parent a64f8d0 commit 1a76ccd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion java/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ clean :
rm -f ScrollView.jar *.class

# all-am does nothing, to make the java part optional.
all all-am :
all all-am install :

# dist runs the autoconf makefile to archive the files correctly.
dist distdir :
Expand Down
24 changes: 14 additions & 10 deletions viewer/svutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,13 @@ void SVSync::StartProcess(const char* executable, const char* args) {
proc.append(" ");
proc.append(args);
std::cout << "Starting " << proc << std::endl;
CreateProcess(NULL, const_cast<char*>(proc.c_str()), NULL,
NULL, FALSE, 0, NULL, NULL, NULL, NULL);
STARTUPINFO start_info;
PROCESS_INFORMATION proc_info;
GetStartupInfo(&start_info);
if (!CreateProcess(NULL, const_cast<char*>(proc.c_str()), NULL, NULL, FALSE,
CREATE_NO_WINDOW | DETACHED_PROCESS, NULL, NULL,
&start_info, &proc_info))
return;
#else
int pid = fork();
if (pid != 0) { // The father process returns
Expand Down Expand Up @@ -288,24 +293,23 @@ SVNetwork::SVNetwork(const char* hostname, int port) {
scrollview_path = ".";
#endif
}
// The following ugly pair of ifdefs are to enable the output of the
// java runtime to be sent down a black hole to ignore all the
// The following ugly ifdef is to enable the output of the java runtime
// to be sent down a black hole on non-windows to ignore all the
// exceptions in piccolo. Ideally piccolo would be debugged to make
// this unnecessary.
// Also the path has to be separated by ; on windows and : otherwise.
#ifdef WIN32
const char* prog = "java";
const char* cmd_template =
const char* cmd_template = "-Djava.library.path=%s -cp %s/luajava-1.1.jar"
";%s/ScrollView.jar;%s/piccolo-1.2.jar;%s/piccolox-1.2.jar"
" com.google.scrollview.ScrollView";
#else
const char* prog = "sh";
const char* cmd_template = "-c \"trap 'kill %1' 0 1 2 ; java "
#endif
"-Djava.library.path=%s -cp %s/luajava-1.1.jar:%s/ScrollView.jar:"
"%s/piccolo-1.2.jar:%s/piccolox-1.2.jar"
" com.google.scrollview.ScrollView"
#ifdef WIN32
;
#else
" >/dev/null 2>&1 & wait\"";
" >/dev/null 2>&1 & wait\"";
#endif
int cmdlen = strlen(cmd_template) + 5*strlen(scrollview_path) + 1;
char* cmd = new char[cmdlen];
Expand Down

0 comments on commit 1a76ccd

Please sign in to comment.