2
0

sdkutil.pas 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. {
  2. sdkutil.pas
  3. SDK utility methods
  4. Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
  5. This file is part of MkSymbian build tool.
  6. MkSymbian is free software;
  7. you can redistribute it and/or modify it under the
  8. terms of the GNU General Public License version 2
  9. as published by the Free Software Foundation.
  10. MkSymbian is distributed in the hope
  11. that it will be useful, but WITHOUT ANY WARRANTY; without even
  12. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  13. PURPOSE. See the GNU General Public License for more details.
  14. Please note that the General Public License version 2 does not permit
  15. incorporating MkSymbian into proprietary programs.
  16. }
  17. unit sdkutil;
  18. {$ifdef fpc}
  19. {$mode delphi}{$H+}
  20. {$endif}
  21. interface
  22. uses
  23. Classes, SysUtils, registry, constants;
  24. type
  25. { TSDKUtil }
  26. TSDKUtil = class(TObject)
  27. public
  28. SDKFolder, SDKPartialFolder, StrSDKVersion: string;
  29. SDKVersion: TSDKVersion;
  30. constructor Create;
  31. procedure LocateUIQ2SDK;
  32. procedure LocateUIQ3SDK;
  33. end;
  34. var
  35. vSDKUtil: TSDKUtil;
  36. implementation
  37. uses projectparser;
  38. { TSDKUtil }
  39. constructor TSDKUtil.Create;
  40. begin
  41. StrSDKVersion := vProject.SDK + ' ' + vProject.SDKVersion;
  42. if StrSDKVersion = Str_UIQ21 then SDKVersion := sdkUIQ21
  43. else if StrSDKVersion = Str_UIQ3 then SDKVersion := sdkUIQ3;
  44. case SDKVersion of
  45. sdkUIQ21: LocateUIQ2SDK;
  46. sdkUIQ3: LocateUIQ3SDK;
  47. end;
  48. end;
  49. procedure TSDKUtil.LocateUIQ2SDK;
  50. begin
  51. SDKPartialFolder := '\Programas\UIQ21\';
  52. SDKFolder := 'C:' + SDKPartialFolder;
  53. end;
  54. procedure TSDKUtil.LocateUIQ3SDK;
  55. var
  56. Reg: TRegistry;
  57. BufferStr: string;
  58. begin
  59. Reg := TRegistry.Create;
  60. try
  61. Reg.RootKey := HKEY_LOCAL_MACHINE;
  62. if Reg.OpenKey('\SOFTWARE\Symbian\UIQ\SDK\UIQ3SDK', False) then
  63. begin
  64. BufferStr := Reg.ReadString('InstallPath');
  65. SDKFolder := IncludeTrailingBackslash(BufferStr);
  66. SDKPartialFolder := Copy(SDKFolder, 3, Length(SDKFolder) - 2);
  67. end
  68. else
  69. begin
  70. WriteLn(' ERROR: Could not locate the SDK, using default values');
  71. SDKPartialFolder := '\Symbian\UIQ3SDK\';
  72. SDKFolder := 'C:' + SDKPartialFolder;
  73. end;
  74. finally
  75. Reg.Free;
  76. end;
  77. end;
  78. end.