From 7b65d35c1044d4e44e77b45f7037084c4346799f Mon Sep 17 00:00:00 2001 From: onefang Date: Thu, 7 Oct 2021 15:25:40 +1000 Subject: Use names instead of numbers in the tmp sim directories. --- src/sledjchisl/sledjchisl.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index eb38df1..09e8100 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c @@ -2084,7 +2084,7 @@ void findWindow(simData *simd, char *sim, char *type, int count, int window, int void prepSims(simData *simd, char *sim, char *type, int count, int window, int panes, int pane) { char *path = xmprintf("%s/%s.shini", scEtc, simd->tab); - char *newPath = xmprintf("%s/sim%d/%s.ini", scTemp, count, simd->tab); // Coz OpenSim sucks. + char *newPath = xmprintf("%s/%s/%s.ini", scTemp, simd->tab, simd->tab); // Coz OpenSim sucks. char *cmd; // Make sure all tmux windows and panes are startned. @@ -2121,7 +2121,7 @@ void prepSims(simData *simd, char *sim, char *type, int count, int window, int p findWindow(simd, sim, type, count, window, panes, pane); simd->portH = startPort + 2 + count * 2; simd->portU = startPort + 3 + count * 2; - cmd = xmprintf("rm -fr %s/sim%d; mkdir -p %s/sim%d; sed -E" + cmd = xmprintf("rm -fr %s/%s; mkdir -p %s/%s; sed -E" " -e 's@\\[Region\\]@" " paneID = \"\\%s\"\\n\\n" "\\[Startup\\]\\n" @@ -2134,8 +2134,8 @@ void prepSims(simData *simd, char *sim, char *type, int count, int window, int p "\\n\\[Region\\]\\n" " InternalPort = %d@'" " %s >%s", - scTemp, count, - scTemp, count, + scTemp, simd->tab, + scTemp, simd->tab, simd->paneID, simd->portH, simd->portU, @@ -2167,10 +2167,10 @@ void startSim(simData *simd, char *sim, char *type, int count, int window, int p snprintf(toybuf, sizeof(toybuf), "%s/current/bin/OpenSim.exe", scRoot); if (! qfile_exist(toybuf)) buildOpensim(); - I("Tmux tab [%d:%s](pane %d) tmux ID %s, from %s/sim%d - %s is starting.", window, type, pane, simd->paneID, scTemp, count, simd->name); + I("Tmux tab [%d:%s](pane %d) tmux ID %s, from %s/%s - %s is starting.", window, type, pane, simd->paneID, scTemp, simd->tab, simd->name); // NOTE - earlier versions of tmux that are still in use don't have the '-T pane title' option, so do it with a printf command. // doTmuxCmd("select-pane -t %s:%s -T '%s'", Tconsole, simd->paneID, simd->tab); - snprintf(toybuf, sizeof(toybuf), "cd %s/current/bin; printf \"\\033]0;%s\\007\"; mono --debug OpenSim.exe -inidirectory=%s/sim%d", scRoot, simd->tab, scTemp, count); + snprintf(toybuf, sizeof(toybuf), "cd %s/current/bin; printf \"\\033]0;%s\\007\"; mono --debug OpenSim.exe -inidirectory=%s/%s", scRoot, simd->tab, scTemp, simd->tab); sendTmuxCmd(simd->paneID, toybuf); if (0 == ourSims->doIt) { @@ -2584,7 +2584,7 @@ gitARend: case RESTART : // "restart 'Welcome sim'" "restart Welcome.shini" "Welcome.shini restart" "restart Welcome.ini" "restart Welcome" "restart" restart everything { - I("Tmux tab [%d:%s](pane %d) tmux ID %s, from %s/sim%d - %s is stopping.", window, type, pane, simd->paneID, scTemp, count, simd->name); + I("Tmux tab [%d:%s](pane %d) tmux ID %s, from %s/%s - %s is stopping.", window, type, pane, simd->paneID, scTemp, simd->tab, simd->name); stopSim(simd, sim, type, count, window, panes, pane); while (checkSimIsRunning(simd->tab)) usleep(100000); @@ -2601,7 +2601,7 @@ gitARend: ; // Do nothing, this is better done in the calling function, coz it has the details. } else if (checkSimIsRunning(simd->tab)) - I("%s is running in Tmux tab [%d:%s](pane %d) tmux ID %s, from %s/sim%d", simd->name, window, type, pane, simd->paneID, scTemp, count); + I("%s is running in Tmux tab [%d:%s](pane %d) tmux ID %s, from %s/%s", simd->name, window, type, pane, simd->paneID, scTemp, simd->tab); else W("%s is not running.", simd->name); break; @@ -2654,7 +2654,7 @@ void stopSims(simData *simd, char *sim, char *type, int count, int window, int p // TODO - should move onto others if this one takes too long, and come back later. // NOTE - these sleeps are guesses, seems to work on my super desktop during testing. if (checkSimIsRunning(simd->tab)) - T("Tmux tab [%d:%s](pane %d) tmux ID %s, from %s/sim%d - %s has NOT stopped YET.", window, type, pane, simd->paneID, scTemp, count, simd->name); + T("Tmux tab [%d:%s](pane %d) tmux ID %s, from %s/%s - %s has NOT stopped YET.", window, type, pane, simd->paneID, scTemp, simd->tab, simd->name); if (simd->users) { ourSims->doIt = 0; @@ -2666,7 +2666,7 @@ void stopSims(simData *simd, char *sim, char *type, int count, int window, int p usleep(100000); usleep(10000); doTmuxCmd("kill-pane -t %s", simd->paneID); - I("Tmux tab [%d:%s](pane %d) tmux ID %s, from %s/sim%d - %s has stopped.", window, type, pane, simd->paneID, scTemp, count, simd->name); + I("Tmux tab [%d:%s](pane %d) tmux ID %s, from %s/%s - %s has stopped.", window, type, pane, simd->paneID, scTemp, simd->tab, simd->name); } } -- cgit v1.1