• R/O
  • SSH
  • HTTPS

splnch: Commit


Commit MetaInfo

Revision102 (tree)
Time2010-04-06 18:11:14
Authorsawasige

Log Message

Vista対応。

Change Summary

Incremental Difference

--- SpLnch/trunk/SetBtn.pas (revision 101)
+++ SpLnch/trunk/SetBtn.pas (revision 102)
@@ -91,7 +91,7 @@
9191 procedure Clear(WithData: Boolean); reintroduce;
9292 procedure Delete(Index: Integer);
9393 procedure Assign(Source: TButtonGroups);
94- function Load(FileName: String): Boolean;
94+ procedure Load(FileName: String);
9595 procedure Save(FileName: String);
9696 end;
9797
@@ -758,7 +758,7 @@
758758 end;
759759
760760 // ボタンファイル読み込み
761-function TButtonGroups.Load(FileName: String): Boolean;
761+procedure TButtonGroups.Load(FileName: String);
762762 var
763763 ButtonGroup: TButtonGroup;
764764 FileStream: TFileStream;
@@ -767,50 +767,40 @@
767767 pWork: PChar;
768768 begin
769769 Clear(True);
770+
771+ FileStream := TFileStream.Create(FileName, fmOpenRead or fmShareExclusive);
772+ MemStream := TMemoryStream.Create;
770773 try
771- FileStream := TFileStream.Create(FileName, fmOpenRead or fmShareExclusive);
772- MemStream := TMemoryStream.Create;
774+ MemStream.CopyFrom(FileStream, FileStream.Size);
775+ MemStream.Position := 0;
776+
777+ Size := Length(BTNHEAD) + 1;
778+ pWork := StrAlloc(Size);
773779 try
774- MemStream.CopyFrom(FileStream, FileStream.Size);
775- MemStream.Position := 0;
776-
777- Size := Length(BTNHEAD) + 1;
778- pWork := StrAlloc(Size);
779- try
780- MemStream.Read(pWork^, Size);
781- if StrPas(pWork) <> BTNHEAD then
782- raise EButtonFileError.Create('ファイル形式が違います。');
783- finally
784- StrDispose(pWork);
785- end;
786-
787- while MemStream.Position < MemStream.Size do
788- begin
789- ButtonGroup := TButtonGroup.Create;
790- try
791- ButtonGroup.LoadFromStream(MemStream);
792- Add(ButtonGroup);
793- except
794- ButtonGroup.Free;
795- end;
796- end;
780+ MemStream.Read(pWork^, Size);
781+ if StrPas(pWork) <> BTNHEAD then
782+ raise EButtonFileError.Create('ファイル形式が違います。' + FileName);
797783 finally
798- FileStream.Free;
799- MemStream.Free;
784+ StrDispose(pWork);
800785 end;
801- Result := True;
802786
803- except
804- on E: EButtonFileError do
787+ while MemStream.Position < MemStream.Size do
805788 begin
806- Result := Application.MessageBox(PChar('ボタンファイルを読み込めませんでした。' +
807- E.Message + 'このまま続けますか?'), '確認', MB_ICONQUESTION or MB_YESNO) = idYes;
789+ ButtonGroup := TButtonGroup.Create;
790+ try
791+ ButtonGroup.LoadFromStream(MemStream);
792+ Add(ButtonGroup);
793+ except
794+ ButtonGroup.Free;
795+ end;
808796 end;
809- else
810- Result := True;
797+ finally
798+ FileStream.Free;
799+ MemStream.Free;
811800 end;
812801
813- if Result and (Count = 0) then
802+
803+ if Count = 0 then
814804 begin
815805 ButtonGroup := TButtonGroup.Create;
816806 Add(ButtonGroup);
--- SpLnch/trunk/Setup/Main.pas (revision 101)
+++ SpLnch/trunk/Setup/Main.pas (revision 102)
@@ -397,6 +397,8 @@
397397 SettingForAllUser: Boolean;
398398 UserFolder: string;
399399 NextPage: TTabSheet;
400+
401+ OSVersionInfo: TOSVersionInfo;
400402 begin
401403 // 最初のページ
402404 if PageControl.ActivePage = tabStart then
@@ -490,7 +492,13 @@
490492 else
491493 begin
492494 chkSettingForAllUser.Checked := False;
493- FUserFolder := GetTargetFolder + FUserName + '\';
495+ OSVersionInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
496+ GetVersionEx(OSVersionInfo);
497+ if (OSVersionInfo.dwPlatformId = VER_PLATFORM_WIN32_NT) and
498+ (OSVersionInfo.dwMajorVersion >= 6) then
499+ FUserFolder := GetEnvironmentVariable('appdata') + '\Special Launch\'
500+ else
501+ FUserFolder := GetTargetFolder + FUserName + '\';
494502 FAllFolder := GetTargetFolder + 'Default\';
495503 edtSL4UserFolder.Text := FUserFolder;
496504
@@ -992,9 +1000,6 @@
9921000 begin
9931001 if not rdoUninstall.Checked then
9941002 begin
995- Msg := Msg + 'が完了しました。';
996- Application.MessageBox(PChar(Msg), '確認', MB_ICONINFORMATION);
997-
9981003 if rdoInstall.Checked then
9991004 begin
10001005 SetupUnlock;
@@ -1003,7 +1008,13 @@
10031008 if not FUpdateInstall then
10041009 if Application.MessageBox('Special Launch のヘルプを表示しますか?', '確認', MB_ICONQUESTION or MB_YESNO) = idYes then
10051010 ShellExecute(Handle, nil, PChar(NewTargetFolder + 'SpLnch.chm'), nil, nil, SW_SHOW);
1011+ end
1012+ else
1013+ begin
1014+ Msg := Msg + 'が完了しました。';
1015+ Application.MessageBox(PChar(Msg), '終了', MB_ICONINFORMATION);
10061016 end;
1017+
10071018 end;
10081019
10091020 Close;
--- SpLnch/trunk/Main.pas (revision 101)
+++ SpLnch/trunk/Main.pas (revision 102)
@@ -118,6 +118,8 @@
118118 begin
119119 Msg := 'パッドの読み込みに失敗しました。' + E.Message;
120120 Application.MessageBox(PChar(Msg), 'エラー', MB_ICONERROR);
121+ Close;
122+ Exit;
121123 end;
122124 end;
123125 Plugins.BeginPlugins;
--- SpLnch/trunk/SetInit.pas (revision 101)
+++ SpLnch/trunk/SetInit.pas (revision 102)
@@ -3,7 +3,7 @@
33 interface
44
55 uses
6- Windows, SysUtils, Forms, IniFiles;
6+ Windows, SysUtils, Forms, IniFiles, About;
77
88 var
99 UserName: string;
@@ -111,7 +111,12 @@
111111
112112 dlgInitFolder := TdlgInitFolder.Create(nil);
113113 try
114- UserFolder := ExtractFilePath(ParamStr(0)) + UserName + '\';
114+ if (OSVersionInfo.dwPlatformId = VER_PLATFORM_WIN32_NT) and
115+ (OSVersionInfo.dwMajorVersion >= 6) then
116+ UserFolder := GetEnvironmentVariable('appdata') + '\Special Launch\'
117+ else
118+ UserFolder := ExtractFilePath(ParamStr(0)) + UserName + '\';
119+
115120 dlgInitFolder.edtInitFolder.Text := UserFolder;
116121 while True do
117122 begin
Show on old repository browser