updateLauncherName method
void
updateLauncherName(
)
override
Implementation
@override
void updateLauncherName() {
if (!hasAllFiles(
[
context.windowsCmakePath,
context.windowsRunnerRcPath,
context.windowsMainCppPath,
],
"Windows launcher name",
)) {
return;
}
final desiredName = common.fetchLauncherName(context);
final escapedDesiredName = common.escapeForDoubleQuotedString(desiredName);
final windowsCmakeData = common.readFile(context.windowsCmakePath);
final updatedWindowsCmakeData = common.replaceFirstMatchOrThrow(
windowsCmakeData,
RegExp(r'(set\(\s*BINARY_NAME\s*")([^"]*)("\s*\))'),
(match) => '${match.group(1)}$escapedDesiredName${match.group(3)}',
"BINARY_NAME in windows CMakeLists",
context.windowsCmakePath,
);
common.overwriteFile(context.windowsCmakePath, updatedWindowsCmakeData);
final windowsMainData = common.readFile(context.windowsMainCppPath);
final updatedWindowsMainData = common.replaceFirstMatchOrThrow(
windowsMainData,
RegExp(r'(window\.Create\(L")([^"]*)(",)'),
(match) => '${match.group(1)}$escapedDesiredName${match.group(3)}',
"window title in main.cpp",
context.windowsMainCppPath,
);
common.overwriteFile(context.windowsMainCppPath, updatedWindowsMainData);
var runnerRcData = common.readFile(context.windowsRunnerRcPath);
runnerRcData = _replaceQuotedVersionValue(
runnerRcData,
"FileDescription",
desiredName,
context.windowsRunnerRcPath,
);
runnerRcData = _replaceQuotedVersionValue(
runnerRcData,
"InternalName",
desiredName,
context.windowsRunnerRcPath,
);
runnerRcData = _replaceQuotedVersionValue(
runnerRcData,
"OriginalFilename",
"$desiredName.exe",
context.windowsRunnerRcPath,
);
runnerRcData = _replaceQuotedVersionValue(
runnerRcData,
"ProductName",
desiredName,
context.windowsRunnerRcPath,
);
common.overwriteFile(context.windowsRunnerRcPath, runnerRcData);
}