mirror of https://github.com/OpenTTD/OpenTTD
(svn r22467) [1.1] -Backport from trunk:
- Fix: When determining the executable path failed, the working directory was used instead, circumventing the not-home-directory check [FS#4613] (r22465) - Fix: [Windows] Prevent a crash when launching OpenTTD with -d from a MSYS console [FS#4587] (r22464) - Fix: Update the saveload window immediatelly after scanning a new directory, so queued events reach the window when already updated [FS#4615] (r22463)release/1.1
parent
2b709f2d38
commit
a7487b5ede
|
@ -293,3 +293,9 @@ Can't change volume inside OpenTTD [FS#4416]
|
|||
in OpenTTD. As a result you can't change the volume inside OpenTTD
|
||||
for backends such as SDL; just use the volume control provided by
|
||||
your operating system.
|
||||
|
||||
Can't run OpenTTD with the -d option from a MSYS console [FS#4587]
|
||||
The MSYS console does not allow OpenTTD to open an extra console for
|
||||
debugging output. Compiling OpenTTD with the --enable-console
|
||||
configure option prevents this issue and allows the -d option to use
|
||||
the MSYS console for its output.
|
||||
|
|
|
@ -860,8 +860,9 @@ extern void DetermineBasePaths(const char *exe);
|
|||
* in the same way we remove the name from the executable name.
|
||||
* @param exe the path to the executable
|
||||
*/
|
||||
void ChangeWorkingDirectory(const char *exe)
|
||||
static bool ChangeWorkingDirectoryToExecutable(const char *exe)
|
||||
{
|
||||
bool success = false;
|
||||
#ifdef WITH_COCOA
|
||||
char *app_bundle = strchr(exe, '.');
|
||||
while (app_bundle != NULL && strncasecmp(app_bundle, ".app", 4) != 0) app_bundle = strchr(&app_bundle[1], '.');
|
||||
|
@ -875,12 +876,17 @@ void ChangeWorkingDirectory(const char *exe)
|
|||
/* If we want to go to the root, we can't use cd C:, but we must use '/' */
|
||||
if (s[-1] == ':') chdir("/");
|
||||
#endif
|
||||
if (chdir(exe) != 0) DEBUG(misc, 0, "Directory with the binary does not exist?");
|
||||
if (chdir(exe) != 0) {
|
||||
DEBUG(misc, 0, "Directory with the binary does not exist?");
|
||||
} else {
|
||||
success = true;
|
||||
}
|
||||
*s = PATHSEPCHAR;
|
||||
}
|
||||
#ifdef WITH_COCOA
|
||||
if (app_bundle != NULL) app_bundle[0] = '.';
|
||||
#endif /* WITH_COCOA */
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -958,14 +964,19 @@ void DetermineBasePaths(const char *exe)
|
|||
_do_scan_working_directory = DoScanWorkingDirectory();
|
||||
|
||||
/* Change the working directory to that one of the executable */
|
||||
ChangeWorkingDirectory(exe);
|
||||
if (getcwd(tmp, MAX_PATH) == NULL) *tmp = '\0';
|
||||
AppendPathSeparator(tmp, MAX_PATH);
|
||||
_searchpaths[SP_BINARY_DIR] = strdup(tmp);
|
||||
if (ChangeWorkingDirectoryToExecutable(exe)) {
|
||||
if (getcwd(tmp, MAX_PATH) == NULL) *tmp = '\0';
|
||||
AppendPathSeparator(tmp, MAX_PATH);
|
||||
_searchpaths[SP_BINARY_DIR] = strdup(tmp);
|
||||
} else {
|
||||
_searchpaths[SP_BINARY_DIR] = NULL;
|
||||
}
|
||||
|
||||
if (_searchpaths[SP_WORKING_DIR] != NULL) {
|
||||
/* Go back to the current working directory. */
|
||||
ChangeWorkingDirectory(_searchpaths[SP_WORKING_DIR]);
|
||||
if (chdir(_searchpaths[SP_WORKING_DIR]) != 0) {
|
||||
DEBUG(misc, 0, "Failed to return to working directory!");
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__MORPHOS__) || defined(__AMIGA__) || defined(DOS) || defined(OS2)
|
||||
|
|
|
@ -211,6 +211,9 @@ void BuildFileList()
|
|||
|
||||
default: FiosGetSavegameList(_saveload_mode); break;
|
||||
}
|
||||
|
||||
/* Invalidate saveload window */
|
||||
InvalidateWindowData(WC_SAVELOAD, 0, 2, true);
|
||||
}
|
||||
|
||||
static void MakeSortedSaveGameList()
|
||||
|
@ -684,6 +687,12 @@ public:
|
|||
!_load_check_data.HasNewGrfs());
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
/* _fios_items changed */
|
||||
this->vscroll->SetCount(_fios_items.Length());
|
||||
this->selected = NULL;
|
||||
_load_check_data.Clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -2485,6 +2485,8 @@ STR_NEWGRF_ERROR_CORRUPT_SPRITE :{YELLOW}{STRING
|
|||
STR_NEWGRF_ERROR_MULTIPLE_ACTION_8 :Conté múltiples Accions 8 entrades
|
||||
STR_NEWGRF_ERROR_READ_BOUNDS :Lectura després de la fi d'un pseudo-sprite
|
||||
STR_NEWGRF_ERROR_MISSING_SPRITES :{WHITE}Al joc de gràfics base establert actualment li falten un nombre d'sprites.{}Si us plau actualitza el joc de gràfics base
|
||||
STR_NEWGRF_ERROR_GRM_FAILED :Els recursos GRF demanats no estan disponibles
|
||||
STR_NEWGRF_ERROR_FORCEFULLY_DISABLED :{2:STRING} ha estat desactivat per {4:STRING}
|
||||
|
||||
# NewGRF related 'general' warnings
|
||||
STR_NEWGRF_POPUP_CAUTION_CAPTION :{WHITE}Alerta!
|
||||
|
|
|
@ -2484,6 +2484,8 @@ STR_NEWGRF_ERROR_CORRUPT_SPRITE :{YELLOW}{STRING
|
|||
STR_NEWGRF_ERROR_MULTIPLE_ACTION_8 :Bevat meerdere 'Action 8'-elementen
|
||||
STR_NEWGRF_ERROR_READ_BOUNDS :Lees voorbij einde van pseudo-sprite
|
||||
STR_NEWGRF_ERROR_MISSING_SPRITES :{WHITE}De huidige basis graphics-set mist een aantal sprites..{}Werk de graphics-set bij aub
|
||||
STR_NEWGRF_ERROR_GRM_FAILED :Gevraagde GRF middelen niet beschikbaar
|
||||
STR_NEWGRF_ERROR_FORCEFULLY_DISABLED :{2:STRING} is uitgeschakeld door {4:STRING}
|
||||
|
||||
# NewGRF related 'general' warnings
|
||||
STR_NEWGRF_POPUP_CAUTION_CAPTION :{WHITE}Waarschuwing!
|
||||
|
|
|
@ -297,7 +297,21 @@ void CreateConsole()
|
|||
|
||||
/* redirect unbuffered STDIN, STDOUT, STDERR to the console */
|
||||
#if !defined(__CYGWIN__)
|
||||
*stdout = *_fdopen( _open_osfhandle((intptr_t)hand, _O_TEXT), "w" );
|
||||
|
||||
/* Check if we can open a handle to STDOUT. */
|
||||
int fd = _open_osfhandle((intptr_t)hand, _O_TEXT);
|
||||
if (fd == -1) {
|
||||
/* Free everything related to the console. */
|
||||
FreeConsole();
|
||||
_has_console = false;
|
||||
_close(fd);
|
||||
CloseHandle(hand);
|
||||
|
||||
ShowInfo("Unable to open an output handle to the console. Check known-bugs.txt for details.");
|
||||
return;
|
||||
}
|
||||
|
||||
*stdout = *_fdopen(fd, "w");
|
||||
*stdin = *_fdopen(_open_osfhandle((intptr_t)GetStdHandle(STD_INPUT_HANDLE), _O_TEXT), "r" );
|
||||
*stderr = *_fdopen(_open_osfhandle((intptr_t)GetStdHandle(STD_ERROR_HANDLE), _O_TEXT), "w" );
|
||||
#else
|
||||
|
|
Loading…
Reference in New Issue