기존 AutoPercenty3 관련 파일 삭제 및 Edit_PartTimer로 이름 변경, 버전 업데이트(3.8.1 -> 3.8.2) 반영
This commit is contained in:
parent
6ae894cfd2
commit
3f9f6515c7
|
|
@ -1,74 +0,0 @@
|
|||
; AutoPercenty3 Inno Setup Script
|
||||
; 이 스크립트는 cx_Freeze로 빌드된 결과물이 있는 "build\exe.win-amd64-3.11" 폴더를 기반으로 인스톨러를 제작합니다.
|
||||
; 20250411_113030에 생성됨
|
||||
|
||||
#define MyAppName "AutoPercenty"
|
||||
#define MyAppVersion "3.8.1"
|
||||
#define MyAppPublisher "WhenRideMyCar"
|
||||
#define MyAppProgramName "오토퍼센티"
|
||||
#define MyAppDescription "편집알바생"
|
||||
#define MyAppCopyright "Copyright 2024"
|
||||
#define MyAppExeName "AutoPercenty3"
|
||||
#define MySetupName "AutoPercenty Setup"
|
||||
#define MySetupIcon "AutoPercenty3.ico"
|
||||
#define MySetupOutputDir "dist/installer"
|
||||
|
||||
[Setup]
|
||||
AppName={#MyAppProgramName}
|
||||
AppVersion={#MyAppVersion}
|
||||
AppPublisher={#MyAppPublisher}
|
||||
AppPublisherURL=
|
||||
; 기본 설치 경로: AppData\Local\AutoPercenty3
|
||||
DefaultDirName={localappdata}\{#MyAppName}
|
||||
DefaultGroupName={#MyAppProgramName}
|
||||
OutputDir={#MySetupOutputDir}
|
||||
OutputBaseFilename={#MySetupName}
|
||||
SetupIconFile={#MySetupIcon}
|
||||
Compression=lzma
|
||||
SolidCompression=yes
|
||||
VersionInfoVersion={#MyAppVersion}
|
||||
VersionInfoCompany={#MyAppPublisher}
|
||||
VersionInfoDescription={#MyAppDescription}
|
||||
VersionInfoCopyright={#MyAppCopyright}
|
||||
VersionInfoProductName={#MyAppProgramName}
|
||||
VersionInfoProductVersion={#MyAppVersion}
|
||||
|
||||
[Languages]
|
||||
Name: "korean"; MessagesFile: "compiler:Languages\Korean.isl"
|
||||
|
||||
[Tasks]
|
||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"
|
||||
|
||||
[Dirs]
|
||||
; 설치 시 {app}\logs 폴더를 생성하고,
|
||||
; Users 그룹에 'modify' 권한(=쓰기 가능)을 부여
|
||||
Name: "{app}\logs"; Permissions: users-modify
|
||||
|
||||
[Files]
|
||||
; cx_Freeze로 빌드된 결과물 모두를 설치 폴더로 복사
|
||||
Source: "build\exe.win-amd64-3.11\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
; VC++ 재배포 패키지 파일을 임시 폴더({tmp})에 복사
|
||||
Source: "VC_redist.x64.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall
|
||||
|
||||
[Icons]
|
||||
; 시작 메뉴 바로가기
|
||||
Name: "{group}\{#MyAppProgramName}"; Filename: "{app}\{#MyAppExeName}.exe"
|
||||
; 바탕화면 바로가기
|
||||
Name: "{autodesktop}\{#MyAppProgramName}"; Filename: "{app}\{#MyAppExeName}.exe"; Tasks: desktopicon
|
||||
|
||||
[Run]
|
||||
; VC++ 재배포 패키지 설치 (필요할 경우)
|
||||
Filename: "{tmp}\VC_redist.x64.exe"; Parameters: "/install /passive /norestart"; StatusMsg: "VC++ 재배포 패키지 설치 중..."; Check: NeedsVCredist
|
||||
; 설치 후 프로그램 실행 (원할 경우 주석 해제)
|
||||
Filename: "{app}\{#MyAppExeName}.exe"; Description: "{cm:LaunchProgram,{#MyAppProgramName}}"; Flags: nowait postinstall skipifsilent
|
||||
|
||||
[Code]
|
||||
function NeedsVCredist: Boolean;
|
||||
begin
|
||||
// 예: 레지스트리 키 확인으로 VC++ 2015~2022 x64 런타임이 깔려있는지 판단
|
||||
// (VC++ 버전에 따라 키/값이 달라질 수 있으므로, 실제 환경에 맞게 수정 필요)
|
||||
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64') then
|
||||
Result := False // 이미 설치됨
|
||||
else
|
||||
Result := True; // 미설치 -> 설치 필요
|
||||
end;
|
||||
|
|
@ -0,0 +1,319 @@
|
|||
; AutoPercenty3 Inno Setup Script
|
||||
; 이 스크립트는 cx_Freeze로 빌드된 결과물이 있는 "build\exe.win-amd64-3.11" 폴더를 기반으로 인스톨러를 제작합니다.
|
||||
; 20250424_061654에 생성됨
|
||||
|
||||
#define AppId "autopercenty"
|
||||
#define MyAppName "Edit_PartTimer"
|
||||
#define MyAppVersion "3.8.2"
|
||||
#define MyAppPublisher "WhenRideMyCar"
|
||||
#define MyAppProgramName "편집알바생"
|
||||
#define MyAppDescription "편집알바생"
|
||||
#define MyAppCopyright "Copyright 2024"
|
||||
#define MyAppExeName "Edit_PartTimer3"
|
||||
#define MySetupName "Edit_PartTimer Setup"
|
||||
#define MySetupIcon "Edit_PartTimer3.ico"
|
||||
#define MySetupOutputDir "dist/installer"
|
||||
#define OldAppName "AutoPercenty3"
|
||||
|
||||
[Setup]
|
||||
; 기본 설정
|
||||
AppId={#AppId}
|
||||
AppName={#MyAppProgramName}
|
||||
AppVersion={#MyAppVersion}
|
||||
AppPublisher={#MyAppPublisher}
|
||||
DefaultDirName={localappdata}\{#MyAppName}
|
||||
DefaultGroupName={#MyAppPublisher}
|
||||
OutputDir={#MySetupOutputDir}
|
||||
OutputBaseFilename={#MySetupName}
|
||||
SetupIconFile={#MySetupIcon}
|
||||
Compression=lzma
|
||||
SolidCompression=yes
|
||||
|
||||
; 업데이트 관련 설정
|
||||
PrivilegesRequired=lowest
|
||||
UpdateUninstallLogAppName=yes
|
||||
AppMutex={#MyAppName}
|
||||
CloseApplications=yes
|
||||
RestartApplications=no
|
||||
|
||||
; 버전 정보
|
||||
VersionInfoVersion={#MyAppVersion}
|
||||
VersionInfoCompany={#MyAppPublisher}
|
||||
VersionInfoDescription={#MyAppDescription}
|
||||
VersionInfoCopyright={#MyAppCopyright}
|
||||
VersionInfoProductName={#MyAppProgramName}
|
||||
VersionInfoProductVersion={#MyAppVersion}
|
||||
|
||||
[Languages]
|
||||
Name: "korean"; MessagesFile: "compiler:Languages\Korean.isl"
|
||||
|
||||
[Tasks]
|
||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"
|
||||
|
||||
[Dirs]
|
||||
; 설치 시 {app}\logs 폴더를 생성하고,
|
||||
; Users 그룹에 'modify' 권한(=쓰기 가능)을 부여
|
||||
Name: "{app}\logs"; Permissions: users-modify
|
||||
|
||||
[Files]
|
||||
; 프로그램 파일만 설치 (항상 덮어쓰기)
|
||||
Source: "build\exe.win-amd64-3.11\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
; VC++ 재배포 패키지 파일을 임시 폴더({tmp})에 복사
|
||||
Source: "VC_redist.x64.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall
|
||||
|
||||
[Icons]
|
||||
; 시작 메뉴 바로가기
|
||||
Name: "{group}\{#MyAppProgramName}"; Filename: "{app}\{#MyAppExeName}.exe"
|
||||
; 바탕화면 바로가기
|
||||
Name: "{autodesktop}\{#MyAppProgramName}"; Filename: "{app}\{#MyAppExeName}.exe"; Tasks: desktopicon
|
||||
|
||||
[Run]
|
||||
; VC++ 재배포 패키지 설치 (필요할 경우)
|
||||
Filename: "{tmp}\VC_redist.x64.exe"; Parameters: "/install /passive /norestart"; StatusMsg: "VC++ 재배포 패키지 설치 중..."; Check: NeedsVCredist
|
||||
; 설치 후 프로그램 실행 (원할 경우)
|
||||
Filename: "{app}\{#MyAppExeName}.exe"; Description: "{cm:LaunchProgram,{#MyAppProgramName}}"; Flags: nowait postinstall skipifsilent
|
||||
|
||||
[Code]
|
||||
function CompareVersion(V1, V2: string): Integer;
|
||||
var
|
||||
P1, P2, N1, N2: Integer;
|
||||
begin
|
||||
P1 := 1;
|
||||
P2 := 1;
|
||||
Result := 0;
|
||||
while (Result = 0) and ((P1 <= Length(V1)) or (P2 <= Length(V2))) do begin
|
||||
while (P1 <= Length(V1)) and (V1[P1] = '.') do Inc(P1);
|
||||
while (P2 <= Length(V2)) and (V2[P2] = '.') do Inc(P2);
|
||||
if (P1 <= Length(V1)) and (P2 <= Length(V2)) then begin
|
||||
N1 := 0; while (P1 <= Length(V1)) and (V1[P1] >= '0') and (V1[P1] <= '9') do begin N1 := N1 * 10 + Ord(V1[P1]) - Ord('0'); Inc(P1); end;
|
||||
N2 := 0; while (P2 <= Length(V2)) and (V2[P2] >= '0') and (V2[P2] <= '9') do begin N2 := N2 * 10 + Ord(V2[P2]) - Ord('0'); Inc(P2); end;
|
||||
if N1 < N2 then Result := -1 else if N1 > N2 then Result := 1;
|
||||
end else begin
|
||||
if P1 <= Length(V1) then Result := 1 else if P2 <= Length(V2) then Result := -1;
|
||||
end;
|
||||
while (P1 <= Length(V1)) and (V1[P1] <> '.') do Inc(P1);
|
||||
while (P2 <= Length(V2)) and (V2[P2] <> '.') do Inc(P2);
|
||||
end;
|
||||
end;
|
||||
|
||||
// 파일 또는 폴더 복사 함수
|
||||
procedure CopyDir(const SourcePath, DestPath: string);
|
||||
var
|
||||
FindRec: TFindRec;
|
||||
SourceFilePath: string;
|
||||
DestFilePath: string;
|
||||
begin
|
||||
ForceDirectories(DestPath);
|
||||
|
||||
if FindFirst(SourcePath + '\*', FindRec) then
|
||||
begin
|
||||
try
|
||||
repeat
|
||||
if (FindRec.Name <> '.') and (FindRec.Name <> '..') then
|
||||
begin
|
||||
SourceFilePath := SourcePath + '\' + FindRec.Name;
|
||||
DestFilePath := DestPath + '\' + FindRec.Name;
|
||||
|
||||
if FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY = 0 then
|
||||
begin
|
||||
if FileCopy(SourceFilePath, DestFilePath, False) then
|
||||
Log('파일 복사 성공: ' + SourceFilePath + ' -> ' + DestFilePath)
|
||||
else
|
||||
Log('파일 복사 실패: ' + SourceFilePath);
|
||||
end
|
||||
else
|
||||
CopyDir(SourceFilePath, DestFilePath);
|
||||
end;
|
||||
until not FindNext(FindRec);
|
||||
finally
|
||||
FindClose(FindRec);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
// 프로그램 실행 여부 확인
|
||||
function IsAppRunning(const FileName: string): Boolean;
|
||||
var
|
||||
Handle: THandle;
|
||||
begin
|
||||
Handle := FindWindowByWindowName('{#MyAppProgramName}'); // 프로그램의 윈도우 타이틀로 찾기
|
||||
Result := (Handle <> 0);
|
||||
end;
|
||||
|
||||
// 프로그램 종료
|
||||
procedure CloseApplication(const FileName: string);
|
||||
var
|
||||
Handle: THandle;
|
||||
begin
|
||||
Handle := FindWindowByWindowName('{#MyAppProgramName}');
|
||||
if Handle <> 0 then
|
||||
begin
|
||||
PostMessage(Handle, 18, 0, 0); // WM_QUIT
|
||||
Sleep(1000); // 종료 대기
|
||||
end;
|
||||
end;
|
||||
|
||||
// VC++ 재배포 패키지 필요 여부 확인
|
||||
function NeedsVCredist: Boolean;
|
||||
begin
|
||||
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64') then
|
||||
Result := False // 이미 설치됨
|
||||
else
|
||||
Result := True; // 미설치 -> 설치 필요
|
||||
end;
|
||||
|
||||
// 설치 완료 후 실행 여부 확인
|
||||
function InitializeFinish(): Boolean;
|
||||
var
|
||||
ResultCode: Integer;
|
||||
begin
|
||||
Result := True;
|
||||
if MsgBox('설치가 완료되었습니다. 프로그램을 실행하시겠습니까?' + #13#10 +
|
||||
'(실행 시 서버와 동기화하여 설정이 업데이트됩니다)',
|
||||
mbConfirmation, MB_YESNO) = IDYES then
|
||||
begin
|
||||
Exec(ExpandConstant('{app}\{#MyAppExeName}.exe'), '', '', SW_SHOW, ewNoWait, ResultCode);
|
||||
end;
|
||||
end;
|
||||
|
||||
function InitializeSetup(): Boolean;
|
||||
var
|
||||
OldVersion: String;
|
||||
NewVersion: String;
|
||||
OldAppPath: String;
|
||||
UserDataSourcePath, UserDataBackupPath: String;
|
||||
OldUninstallString: String;
|
||||
ResultCode: Integer;
|
||||
begin
|
||||
Result := True;
|
||||
NewVersion := '{#MyAppVersion}';
|
||||
UserDataBackupPath := ExpandConstant('{tmp}\user_data_backup');
|
||||
|
||||
// 이전 버전(AutoPercenty3) 확인
|
||||
if RegQueryStringValue(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{#OldAppName}_is1',
|
||||
'DisplayVersion', OldVersion) then
|
||||
begin
|
||||
// 이전 설치 경로 가져오기
|
||||
if RegQueryStringValue(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{#OldAppName}_is1',
|
||||
'InstallLocation', OldAppPath) then
|
||||
begin
|
||||
Log('이전 버전({#OldAppName})이 발견되었습니다. 경로: ' + OldAppPath);
|
||||
|
||||
// user_data 폴더 경로 설정
|
||||
UserDataSourcePath := OldAppPath + '\lib\user_data';
|
||||
|
||||
// 프로그램이 실행 중인지 확인하고 종료 요청
|
||||
if IsAppRunning('{#OldAppName}.exe') then
|
||||
begin
|
||||
if MsgBox('프로그램을 업데이트하기 위해 실행 중인 프로그램을 종료해야 합니다.' + #13#10 +
|
||||
'계속하시겠습니까?', mbConfirmation, MB_YESNO) = IDNO then
|
||||
begin
|
||||
Result := False;
|
||||
exit;
|
||||
end;
|
||||
CloseApplication('{#OldAppName}.exe');
|
||||
// 프로세스가 완전히 종료될 때까지 대기
|
||||
Sleep(2000);
|
||||
end;
|
||||
|
||||
// user_data 폴더 백업
|
||||
if DirExists(UserDataSourcePath) then
|
||||
begin
|
||||
Log('user_data 폴더 백업 중: ' + UserDataSourcePath + ' -> ' + UserDataBackupPath);
|
||||
ForceDirectories(UserDataBackupPath);
|
||||
CopyDir(UserDataSourcePath, UserDataBackupPath);
|
||||
end;
|
||||
|
||||
// 이전 버전 제거 (제거 프로그램 실행)
|
||||
if RegQueryStringValue(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{#OldAppName}_is1',
|
||||
'UninstallString', OldUninstallString) then
|
||||
begin
|
||||
// 사용자에게 확인
|
||||
if MsgBox('이전 버전을 제거하고 새 버전을 설치하시겠습니까?' + #13#10 +
|
||||
'사용자 데이터는 유지됩니다.', mbConfirmation, MB_YESNO) = IDYES then
|
||||
begin
|
||||
// 자동 제거를 위해 /SILENT 매개변수 추가
|
||||
OldUninstallString := OldUninstallString + ' /SILENT';
|
||||
Log('이전 버전 제거 실행: ' + OldUninstallString);
|
||||
|
||||
// 제거 프로그램 실행 및 완료 대기
|
||||
if Exec(RemoveQuotes(OldUninstallString), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
|
||||
begin
|
||||
Log('이전 버전 제거 완료: 결과 코드 ' + IntToStr(ResultCode));
|
||||
end
|
||||
else
|
||||
begin
|
||||
Log('이전 버전 제거 실패');
|
||||
// 제거에 실패해도 계속 진행
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
// 현재 프로그램(Edit_PartTimer3) 버전 확인
|
||||
else if RegQueryStringValue(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{#MyAppName}_is1',
|
||||
'DisplayVersion', OldVersion) then
|
||||
begin
|
||||
// 같은 버전이거나 더 높은 버전이 설치되어 있는 경우
|
||||
if CompareVersion(OldVersion, NewVersion) >= 0 then
|
||||
begin
|
||||
MsgBox('현재 설치된 버전(' + OldVersion + ')이 이 설치 프로그램의 버전(' +
|
||||
NewVersion + ')과 같거나 더 높습니다.' + #13#10 +
|
||||
'설치를 계속할 수 없습니다.', mbInformation, MB_OK);
|
||||
Result := False;
|
||||
exit;
|
||||
end;
|
||||
|
||||
// 이전 버전이 설치되어 있는 경우 업데이트 모드로 진행
|
||||
if CompareVersion(OldVersion, NewVersion) < 0 then
|
||||
begin
|
||||
Log('업데이트 설치 진행: ' + OldVersion + ' -> ' + NewVersion);
|
||||
|
||||
// 프로그램이 실행 중인지 확인하고 종료 요청
|
||||
if IsAppRunning('{#MyAppExeName}.exe') then
|
||||
begin
|
||||
if MsgBox('프로그램을 업데이트하기 위해 실행 중인 프로그램을 종료해야 합니다.' + #13#10 +
|
||||
'계속하시겠습니까?', mbConfirmation, MB_YESNO) = IDNO then
|
||||
begin
|
||||
Result := False;
|
||||
exit;
|
||||
end;
|
||||
CloseApplication('{#MyAppExeName}.exe');
|
||||
end;
|
||||
|
||||
// Edit_PartTimer3의 user_data 폴더 백업
|
||||
if RegQueryStringValue(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{#MyAppName}_is1',
|
||||
'InstallLocation', OldAppPath) then
|
||||
begin
|
||||
UserDataSourcePath := OldAppPath + '\lib\user_data';
|
||||
if DirExists(UserDataSourcePath) then
|
||||
begin
|
||||
Log('user_data 폴더 백업 중: ' + UserDataSourcePath + ' -> ' + UserDataBackupPath);
|
||||
ForceDirectories(UserDataBackupPath);
|
||||
CopyDir(UserDataSourcePath, UserDataBackupPath);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure CurStepChanged(CurStep: TSetupStep);
|
||||
var
|
||||
UserDataBackupPath, UserDataDestPath: String;
|
||||
begin
|
||||
// 설치 완료 후
|
||||
if CurStep = ssPostInstall then
|
||||
begin
|
||||
UserDataBackupPath := ExpandConstant('{tmp}\user_data_backup');
|
||||
UserDataDestPath := ExpandConstant('{app}\lib\user_data');
|
||||
|
||||
// 백업한 user_data 폴더가 있으면 복원
|
||||
if DirExists(UserDataBackupPath) then
|
||||
begin
|
||||
Log('백업된 user_data 폴더 복원 중: ' + UserDataBackupPath + ' -> ' + UserDataDestPath);
|
||||
ForceDirectories(UserDataDestPath);
|
||||
CopyDir(UserDataBackupPath, UserDataDestPath);
|
||||
Log('user_data 폴더 복원 완료');
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 909 B |
257
generate_iss.py
257
generate_iss.py
|
|
@ -43,10 +43,11 @@ def generate_iss_file():
|
|||
iss_filename = f"AutoPercenty_{date_str}.iss"
|
||||
|
||||
# 템플릿 작성
|
||||
iss_template = f"""; AutoPercenty3 Inno Setup Script
|
||||
; 이 스크립트는 cx_Freeze로 빌드된 결과물이 있는 "build\\exe.win-amd64-3.11" 폴더를 기반으로 인스톨러를 제작합니다.
|
||||
iss_template = fr"""; AutoPercenty3 Inno Setup Script
|
||||
; 이 스크립트는 cx_Freeze로 빌드된 결과물이 있는 "build\exe.win-amd64-3.11" 폴더를 기반으로 인스톨러를 제작합니다.
|
||||
; {date_str}에 생성됨
|
||||
|
||||
#define AppId "{version_module.__program_id__}"
|
||||
#define MyAppName "{version_module.__title__}"
|
||||
#define MyAppVersion "{version_module.__version__}"
|
||||
#define MyAppPublisher "{version_module.__company_name__}"
|
||||
|
|
@ -57,15 +58,16 @@ def generate_iss_file():
|
|||
#define MySetupName "{version_module.__setup_name__}"
|
||||
#define MySetupIcon "{version_module.__icon_file__}"
|
||||
#define MySetupOutputDir "{version_module.__setup_output_dir__}"
|
||||
#define OldAppName "AutoPercenty3"
|
||||
|
||||
[Setup]
|
||||
; 기본 설정
|
||||
AppId={{{{YOUR-APP-ID}}}}
|
||||
AppId={{#AppId}}
|
||||
AppName={{#MyAppProgramName}}
|
||||
AppVersion={{#MyAppVersion}}
|
||||
AppPublisher={{#MyAppPublisher}}
|
||||
DefaultDirName={{localappdata}}\\{{#MyAppName}}
|
||||
DefaultGroupName={{#MyAppProgramName}}
|
||||
DefaultDirName={{localappdata}}\{{#MyAppName}}
|
||||
DefaultGroupName={{#MyAppPublisher}}
|
||||
OutputDir={{#MySetupOutputDir}}
|
||||
OutputBaseFilename={{#MySetupName}}
|
||||
SetupIconFile={{#MySetupIcon}}
|
||||
|
|
@ -88,73 +90,88 @@ VersionInfoProductName={{#MyAppProgramName}}
|
|||
VersionInfoProductVersion={{#MyAppVersion}}
|
||||
|
||||
[Languages]
|
||||
Name: "korean"; MessagesFile: "compiler:Languages\\Korean.isl"
|
||||
Name: "korean"; MessagesFile: "compiler:Languages\Korean.isl"
|
||||
|
||||
[Tasks]
|
||||
Name: "desktopicon"; Description: "{{cm:CreateDesktopIcon}}"; GroupDescription: "{{cm:AdditionalIcons}}"
|
||||
|
||||
[Dirs]
|
||||
; 설치 시 {{app}}\\logs 폴더를 생성하고,
|
||||
; 설치 시 {{app}}\logs 폴더를 생성하고,
|
||||
; Users 그룹에 'modify' 권한(=쓰기 가능)을 부여
|
||||
Name: "{{app}}\\logs"; Permissions: users-modify
|
||||
Name: "{{app}}\logs"; Permissions: users-modify
|
||||
|
||||
[Files]
|
||||
; 프로그램 파일만 설치 (항상 덮어쓰기)
|
||||
Source: "build\\exe.win-amd64-3.11\\*"; DestDir: "{{app}}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
Source: "build\exe.win-amd64-3.11\*"; DestDir: "{{app}}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
; VC++ 재배포 패키지 파일을 임시 폴더({{tmp}})에 복사
|
||||
Source: "VC_redist.x64.exe"; DestDir: "{{tmp}}"; Flags: deleteafterinstall
|
||||
|
||||
[Icons]
|
||||
; 시작 메뉴 바로가기
|
||||
Name: "{{group}}\\{{#MyAppProgramName}}"; Filename: "{{app}}\\{{#MyAppExeName}}.exe"
|
||||
Name: "{{group}}\{{#MyAppProgramName}}"; Filename: "{{app}}\{{#MyAppExeName}}.exe"
|
||||
; 바탕화면 바로가기
|
||||
Name: "{{autodesktop}}\\{{#MyAppProgramName}}"; Filename: "{{app}}\\{{#MyAppExeName}}.exe"; Tasks: desktopicon
|
||||
Name: "{{autodesktop}}\{{#MyAppProgramName}}"; Filename: "{{app}}\{{#MyAppExeName}}.exe"; Tasks: desktopicon
|
||||
|
||||
[Run]
|
||||
; VC++ 재배포 패키지 설치 (필요할 경우)
|
||||
Filename: "{{tmp}}\\VC_redist.x64.exe"; Parameters: "/install /passive /norestart"; StatusMsg: "VC++ 재배포 패키지 설치 중..."; Check: NeedsVCredist
|
||||
Filename: "{{tmp}}\VC_redist.x64.exe"; Parameters: "/install /passive /norestart"; StatusMsg: "VC++ 재배포 패키지 설치 중..."; Check: NeedsVCredist
|
||||
; 설치 후 프로그램 실행 (원할 경우)
|
||||
Filename: "{{app}}\\{{#MyAppExeName}}.exe"; Description: "{{cm:LaunchProgram,{{#MyAppProgramName}}}}"; Flags: nowait postinstall skipifsilent
|
||||
Filename: "{{app}}\{{#MyAppExeName}}.exe"; Description: "{{cm:LaunchProgram,{{#MyAppProgramName}}}}"; Flags: nowait postinstall skipifsilent
|
||||
|
||||
[Code]
|
||||
function InitializeSetup(): Boolean;
|
||||
function CompareVersion(V1, V2: string): Integer;
|
||||
var
|
||||
OldVersion: String;
|
||||
NewVersion: String;
|
||||
P1, P2, N1, N2: Integer;
|
||||
begin
|
||||
Result := True;
|
||||
NewVersion := '{{#MyAppVersion}}';
|
||||
|
||||
// 이전 버전 확인
|
||||
if RegQueryStringValue(HKLM, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{{#MyAppName}}_is1',
|
||||
'DisplayVersion', OldVersion) then
|
||||
begin
|
||||
// 같은 버전이거나 더 높은 버전이 설치되어 있는 경우
|
||||
if CompareVersion(OldVersion, NewVersion) >= 0 then
|
||||
begin
|
||||
MsgBox('현재 설치된 버전(' + OldVersion + ')이 이 설치 프로그램의 버전(' +
|
||||
NewVersion + ')과 같거나 더 높습니다.' + #13#10 +
|
||||
'설치를 계속할 수 없습니다.', mbInformation, MB_OK);
|
||||
Result := False;
|
||||
exit;
|
||||
P1 := 1;
|
||||
P2 := 1;
|
||||
Result := 0;
|
||||
while (Result = 0) and ((P1 <= Length(V1)) or (P2 <= Length(V2))) do begin
|
||||
while (P1 <= Length(V1)) and (V1[P1] = '.') do Inc(P1);
|
||||
while (P2 <= Length(V2)) and (V2[P2] = '.') do Inc(P2);
|
||||
if (P1 <= Length(V1)) and (P2 <= Length(V2)) then begin
|
||||
N1 := 0; while (P1 <= Length(V1)) and (V1[P1] >= '0') and (V1[P1] <= '9') do begin N1 := N1 * 10 + Ord(V1[P1]) - Ord('0'); Inc(P1); end;
|
||||
N2 := 0; while (P2 <= Length(V2)) and (V2[P2] >= '0') and (V2[P2] <= '9') do begin N2 := N2 * 10 + Ord(V2[P2]) - Ord('0'); Inc(P2); end;
|
||||
if N1 < N2 then Result := -1 else if N1 > N2 then Result := 1;
|
||||
end else begin
|
||||
if P1 <= Length(V1) then Result := 1 else if P2 <= Length(V2) then Result := -1;
|
||||
end;
|
||||
|
||||
// 이전 버전이 설치되어 있는 경우 업데이트 모드로 진행
|
||||
if CompareVersion(OldVersion, NewVersion) < 0 then
|
||||
begin
|
||||
Log('업데이트 설치 진행: ' + OldVersion + ' -> ' + NewVersion);
|
||||
|
||||
// 프로그램이 실행 중인지 확인하고 종료 요청
|
||||
if IsAppRunning('{{#MyAppExeName}}.exe') then
|
||||
begin
|
||||
if MsgBox('프로그램을 업데이트하기 위해 실행 중인 프로그램을 종료해야 합니다.' + #13#10 +
|
||||
'계속하시겠습니까?', mbConfirmation, MB_YESNO) = IDNO then
|
||||
while (P1 <= Length(V1)) and (V1[P1] <> '.') do Inc(P1);
|
||||
while (P2 <= Length(V2)) and (V2[P2] <> '.') do Inc(P2);
|
||||
end;
|
||||
end;
|
||||
|
||||
// 파일 또는 폴더 복사 함수
|
||||
procedure CopyDir(const SourcePath, DestPath: string);
|
||||
var
|
||||
FindRec: TFindRec;
|
||||
SourceFilePath: string;
|
||||
DestFilePath: string;
|
||||
begin
|
||||
ForceDirectories(DestPath);
|
||||
|
||||
if FindFirst(SourcePath + '\*', FindRec) then
|
||||
begin
|
||||
try
|
||||
repeat
|
||||
if (FindRec.Name <> '.') and (FindRec.Name <> '..') then
|
||||
begin
|
||||
Result := False;
|
||||
exit;
|
||||
SourceFilePath := SourcePath + '\' + FindRec.Name;
|
||||
DestFilePath := DestPath + '\' + FindRec.Name;
|
||||
|
||||
if FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY = 0 then
|
||||
begin
|
||||
if FileCopy(SourceFilePath, DestFilePath, False) then
|
||||
Log('파일 복사 성공: ' + SourceFilePath + ' -> ' + DestFilePath)
|
||||
else
|
||||
Log('파일 복사 실패: ' + SourceFilePath);
|
||||
end
|
||||
else
|
||||
CopyDir(SourceFilePath, DestFilePath);
|
||||
end;
|
||||
CloseApplication('{{#MyAppExeName}}.exe');
|
||||
end;
|
||||
until not FindNext(FindRec);
|
||||
finally
|
||||
FindClose(FindRec);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
|
@ -184,7 +201,7 @@ end;
|
|||
// VC++ 재배포 패키지 필요 여부 확인
|
||||
function NeedsVCredist: Boolean;
|
||||
begin
|
||||
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\\Microsoft\\VisualStudio\\14.0\\VC\\Runtimes\\x64') then
|
||||
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64') then
|
||||
Result := False // 이미 설치됨
|
||||
else
|
||||
Result := True; // 미설치 -> 설치 필요
|
||||
|
|
@ -192,13 +209,157 @@ end;
|
|||
|
||||
// 설치 완료 후 실행 여부 확인
|
||||
function InitializeFinish(): Boolean;
|
||||
var
|
||||
ResultCode: Integer;
|
||||
begin
|
||||
Result := True;
|
||||
if MsgBox('설치가 완료되었습니다. 프로그램을 실행하시겠습니까?' + #13#10 +
|
||||
'(실행 시 서버와 동기화하여 설정이 업데이트됩니다)',
|
||||
mbConfirmation, MB_YESNO) = IDYES then
|
||||
begin
|
||||
Exec(ExpandConstant('{{app}}\\{{#MyAppExeName}}.exe'), '', '', SW_SHOW, ewNoWait, ResultCode);
|
||||
Exec(ExpandConstant('{{app}}\{{#MyAppExeName}}.exe'), '', '', SW_SHOW, ewNoWait, ResultCode);
|
||||
end;
|
||||
end;
|
||||
|
||||
function InitializeSetup(): Boolean;
|
||||
var
|
||||
OldVersion: String;
|
||||
NewVersion: String;
|
||||
OldAppPath: String;
|
||||
UserDataSourcePath, UserDataBackupPath: String;
|
||||
OldUninstallString: String;
|
||||
ResultCode: Integer;
|
||||
begin
|
||||
Result := True;
|
||||
NewVersion := '{{#MyAppVersion}}';
|
||||
UserDataBackupPath := ExpandConstant('{{tmp}}\user_data_backup');
|
||||
|
||||
// 이전 버전(AutoPercenty3) 확인
|
||||
if RegQueryStringValue(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{{#OldAppName}}_is1',
|
||||
'DisplayVersion', OldVersion) then
|
||||
begin
|
||||
// 이전 설치 경로 가져오기
|
||||
if RegQueryStringValue(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{{#OldAppName}}_is1',
|
||||
'InstallLocation', OldAppPath) then
|
||||
begin
|
||||
Log('이전 버전({{#OldAppName}})이 발견되었습니다. 경로: ' + OldAppPath);
|
||||
|
||||
// user_data 폴더 경로 설정
|
||||
UserDataSourcePath := OldAppPath + '\lib\user_data';
|
||||
|
||||
// 프로그램이 실행 중인지 확인하고 종료 요청
|
||||
if IsAppRunning('{{#OldAppName}}.exe') then
|
||||
begin
|
||||
if MsgBox('프로그램을 업데이트하기 위해 실행 중인 프로그램을 종료해야 합니다.' + #13#10 +
|
||||
'계속하시겠습니까?', mbConfirmation, MB_YESNO) = IDNO then
|
||||
begin
|
||||
Result := False;
|
||||
exit;
|
||||
end;
|
||||
CloseApplication('{{#OldAppName}}.exe');
|
||||
// 프로세스가 완전히 종료될 때까지 대기
|
||||
Sleep(2000);
|
||||
end;
|
||||
|
||||
// user_data 폴더 백업
|
||||
if DirExists(UserDataSourcePath) then
|
||||
begin
|
||||
Log('user_data 폴더 백업 중: ' + UserDataSourcePath + ' -> ' + UserDataBackupPath);
|
||||
ForceDirectories(UserDataBackupPath);
|
||||
CopyDir(UserDataSourcePath, UserDataBackupPath);
|
||||
end;
|
||||
|
||||
// 이전 버전 제거 (제거 프로그램 실행)
|
||||
if RegQueryStringValue(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{{#OldAppName}}_is1',
|
||||
'UninstallString', OldUninstallString) then
|
||||
begin
|
||||
// 사용자에게 확인
|
||||
if MsgBox('이전 버전을 제거하고 새 버전을 설치하시겠습니까?' + #13#10 +
|
||||
'사용자 데이터는 유지됩니다.', mbConfirmation, MB_YESNO) = IDYES then
|
||||
begin
|
||||
// 자동 제거를 위해 /SILENT 매개변수 추가
|
||||
OldUninstallString := OldUninstallString + ' /SILENT';
|
||||
Log('이전 버전 제거 실행: ' + OldUninstallString);
|
||||
|
||||
// 제거 프로그램 실행 및 완료 대기
|
||||
if Exec(RemoveQuotes(OldUninstallString), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
|
||||
begin
|
||||
Log('이전 버전 제거 완료: 결과 코드 ' + IntToStr(ResultCode));
|
||||
end
|
||||
else
|
||||
begin
|
||||
Log('이전 버전 제거 실패');
|
||||
// 제거에 실패해도 계속 진행
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
// 현재 프로그램(Edit_PartTimer3) 버전 확인
|
||||
else if RegQueryStringValue(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{{#MyAppName}}_is1',
|
||||
'DisplayVersion', OldVersion) then
|
||||
begin
|
||||
// 같은 버전이거나 더 높은 버전이 설치되어 있는 경우
|
||||
if CompareVersion(OldVersion, NewVersion) >= 0 then
|
||||
begin
|
||||
MsgBox('현재 설치된 버전(' + OldVersion + ')이 이 설치 프로그램의 버전(' +
|
||||
NewVersion + ')과 같거나 더 높습니다.' + #13#10 +
|
||||
'설치를 계속할 수 없습니다.', mbInformation, MB_OK);
|
||||
Result := False;
|
||||
exit;
|
||||
end;
|
||||
|
||||
// 이전 버전이 설치되어 있는 경우 업데이트 모드로 진행
|
||||
if CompareVersion(OldVersion, NewVersion) < 0 then
|
||||
begin
|
||||
Log('업데이트 설치 진행: ' + OldVersion + ' -> ' + NewVersion);
|
||||
|
||||
// 프로그램이 실행 중인지 확인하고 종료 요청
|
||||
if IsAppRunning('{{#MyAppExeName}}.exe') then
|
||||
begin
|
||||
if MsgBox('프로그램을 업데이트하기 위해 실행 중인 프로그램을 종료해야 합니다.' + #13#10 +
|
||||
'계속하시겠습니까?', mbConfirmation, MB_YESNO) = IDNO then
|
||||
begin
|
||||
Result := False;
|
||||
exit;
|
||||
end;
|
||||
CloseApplication('{{#MyAppExeName}}.exe');
|
||||
end;
|
||||
|
||||
// Edit_PartTimer3의 user_data 폴더 백업
|
||||
if RegQueryStringValue(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{{#MyAppName}}_is1',
|
||||
'InstallLocation', OldAppPath) then
|
||||
begin
|
||||
UserDataSourcePath := OldAppPath + '\lib\user_data';
|
||||
if DirExists(UserDataSourcePath) then
|
||||
begin
|
||||
Log('user_data 폴더 백업 중: ' + UserDataSourcePath + ' -> ' + UserDataBackupPath);
|
||||
ForceDirectories(UserDataBackupPath);
|
||||
CopyDir(UserDataSourcePath, UserDataBackupPath);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure CurStepChanged(CurStep: TSetupStep);
|
||||
var
|
||||
UserDataBackupPath, UserDataDestPath: String;
|
||||
begin
|
||||
// 설치 완료 후
|
||||
if CurStep = ssPostInstall then
|
||||
begin
|
||||
UserDataBackupPath := ExpandConstant('{{tmp}}\user_data_backup');
|
||||
UserDataDestPath := ExpandConstant('{{app}}\lib\user_data');
|
||||
|
||||
// 백업한 user_data 폴더가 있으면 복원
|
||||
if DirExists(UserDataBackupPath) then
|
||||
begin
|
||||
Log('백업된 user_data 폴더 복원 중: ' + UserDataBackupPath + ' -> ' + UserDataDestPath);
|
||||
ForceDirectories(UserDataDestPath);
|
||||
CopyDir(UserDataBackupPath, UserDataDestPath);
|
||||
Log('user_data 폴더 복원 완료');
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
"""
|
||||
|
|
|
|||
30
main.py
30
main.py
|
|
@ -24,26 +24,26 @@ def set_dpi_awareness():
|
|||
|
||||
def main():
|
||||
|
||||
# # 로그 파일 경로 설정 수정
|
||||
# # 실행 파일 경로 대신 현재 스크립트 경로를 기준으로 로그 파일 생성
|
||||
# script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
# logs_dir = os.path.join(script_dir, "logs")
|
||||
# 로그 파일 경로 설정 수정
|
||||
# 실행 파일 경로 대신 현재 스크립트 경로를 기준으로 로그 파일 생성
|
||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
logs_dir = os.path.join(script_dir, "logs")
|
||||
|
||||
# # 로그 디렉토리 생성 (존재하지 않는 경우)
|
||||
# try:
|
||||
# if not os.path.exists(logs_dir):
|
||||
# os.makedirs(logs_dir)
|
||||
# except Exception as e:
|
||||
# print(f"로그 디렉토리 생성 실패: {e}")
|
||||
# logs_dir = script_dir # 실패 시 스크립트 디렉토리 사용
|
||||
# 로그 디렉토리 생성 (존재하지 않는 경우)
|
||||
try:
|
||||
if not os.path.exists(logs_dir):
|
||||
os.makedirs(logs_dir)
|
||||
except Exception as e:
|
||||
print(f"로그 디렉토리 생성 실패: {e}")
|
||||
logs_dir = script_dir # 실패 시 스크립트 디렉토리 사용
|
||||
|
||||
# log_file_path = os.path.join(logs_dir, "autopercenty3.log")
|
||||
log_file_path = os.path.join(logs_dir, "Edit_PartTimer3.log")
|
||||
|
||||
# # 로그 파일 경로 출력 (디버깅용)
|
||||
# print(f"로그 파일 경로: {log_file_path}")
|
||||
|
||||
# 로거 초기화 - __version__.py에서 정의된 로그 레벨 사용
|
||||
logger = Logger(log_file="Autopercenty3.log", logger_name="AP3_Logger", level=__log_level__)
|
||||
logger = Logger(log_file=log_file_path, logger_name="EP3_Logger", level=__log_level__)
|
||||
|
||||
logger.log("===== 프로그램 시작 =====", level=logging.INFO)
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ def main():
|
|||
# 애플리케이션 아이콘 설정
|
||||
try:
|
||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
icon_path = os.path.join(script_dir, "AutoPercenty3.ico")
|
||||
icon_path = os.path.join(script_dir, "Edit_PartTimer3.ico")
|
||||
if os.path.exists(icon_path):
|
||||
from PySide6.QtGui import QIcon
|
||||
app.setWindowIcon(QIcon(icon_path))
|
||||
|
|
@ -94,7 +94,7 @@ def main():
|
|||
# 윈도우에도 아이콘 설정
|
||||
try:
|
||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
icon_path = os.path.join(script_dir, "AutoPercenty3.ico")
|
||||
icon_path = os.path.join(script_dir, "Edit_PartTimer3.ico")
|
||||
if os.path.exists(icon_path):
|
||||
from PySide6.QtGui import QIcon
|
||||
app_icon = QIcon(icon_path)
|
||||
|
|
|
|||
6
setup.py
6
setup.py
|
|
@ -118,7 +118,7 @@ include_files = dll_include_files + paddle_includes + [
|
|||
|
||||
# 나머지 파일들
|
||||
('src/ppocr/PP_Models', 'lib/src/ppocr/PP_Models'),
|
||||
('AutoPercenty3.ico', 'AutoPercenty3.ico'),
|
||||
('Edit_PartTimer3.ico', 'Edit_PartTimer3.ico'),
|
||||
('win.exe.manifest', 'win.exe.manifest'),
|
||||
('libssl-3-x64.dll', 'libssl-3-x64.dll'),
|
||||
('libcrypto-3-x64.dll', 'libcrypto-3-x64.dll'),
|
||||
|
|
@ -177,8 +177,8 @@ executables = [
|
|||
Executable(
|
||||
'main.py',
|
||||
base=base,
|
||||
target_name='AutoPercenty3.exe',
|
||||
icon='AutoPercenty3.ico'
|
||||
target_name='Edit_PartTimer3.exe',
|
||||
icon='Edit_PartTimer3.ico'
|
||||
)
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
import logging
|
||||
|
||||
""" 프로그램 기본 정보 """
|
||||
__title__ = "AutoPercenty"
|
||||
__title__ = "Edit_PartTimer"
|
||||
__description__ = "편집알바생"
|
||||
__version__ = "3.8.1"
|
||||
__version__ = "3.8.2"
|
||||
__build__ = "1" # 빌드 번호
|
||||
__author__ = "WhenRideMyCar"
|
||||
__author_email__ = "abc@gmail.com"
|
||||
|
|
@ -15,13 +15,13 @@ __license__ = "MIT"
|
|||
__copyright__ = "Copyright 2024"
|
||||
|
||||
""" 프로그램 추가 정보 """
|
||||
__program_name__ = "오토퍼센티" # 표시용 한글 이름
|
||||
__program_name__ = "편집알바생" # 표시용 한글 이름
|
||||
__program_id__ = "autopercenty" # 시스템 내부 식별자
|
||||
__company_name__ = "WhenRideMyCar"
|
||||
|
||||
""" 로깅 설정 """
|
||||
# 개발 모드에서는 DEBUG, 패키지된 버전에서는 INFO로 설정됩니다
|
||||
__log_level__ = logging.DEBUG
|
||||
__log_level__ = logging.INFO
|
||||
|
||||
""" 설치 관련 정보 """
|
||||
__install_requires__ = [
|
||||
|
|
@ -33,12 +33,12 @@ __install_requires__ = [
|
|||
]
|
||||
|
||||
""" 실행 파일 정보 (Windows) """
|
||||
__exe_name__ = "AutoPercenty3"
|
||||
__icon_file__ = "AutoPercenty3.ico"
|
||||
__exe_name__ = "Edit_PartTimer3"
|
||||
__icon_file__ = "Edit_PartTimer3.ico"
|
||||
__main_script__ = "main.py"
|
||||
|
||||
""" InnoSetup 설치 프로그램 정보 """
|
||||
__setup_name__ = "AutoPercenty Setup"
|
||||
__setup_name__ = "Edit_PartTimer Setup"
|
||||
__publisher__ = __company_name__
|
||||
__setup_icon__ = __icon_file__
|
||||
__setup_output_dir__ = "dist/installer"
|
||||
|
|
|
|||
Loading…
Reference in New Issue