sdkutil.pas 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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;
  24. type
  25. { TSDKUtil }
  26. TSDKUtil = class(TObject)
  27. private
  28. vSDKFolder, vSDKPartialFolder: string;
  29. public
  30. constructor Create;
  31. procedure LocateSDK;
  32. property SDKFolder: string read vSDKFolder;
  33. property SDKPartialFolder: string read vSDKPartialFolder;
  34. end;
  35. var
  36. vSDKUtil: TSDKUtil;
  37. implementation
  38. { TSDKUtil }
  39. procedure TSDKUtil.LocateSDK;
  40. var
  41. Reg: TRegistry;
  42. BufferStr: string;
  43. begin
  44. Reg := TRegistry.Create;
  45. try
  46. Reg.RootKey := HKEY_LOCAL_MACHINE;
  47. if Reg.OpenKey('\SOFTWARE\Symbian\UIQ\SDK\UIQ3SDK', False) then
  48. begin
  49. BufferStr := Reg.ReadString('InstallPath');
  50. vSDKFolder := IncludeTrailingBackslash(BufferStr);
  51. vSDKPartialFolder := Copy(vSDKFolder, 3, Length(vSDKFolder) - 2);
  52. end
  53. else
  54. begin
  55. WriteLn(' ERROR: Could not locate the SDK, using default values');
  56. vSDKPartialFolder := '\Symbian\UIQ3SDK\';
  57. vSDKFolder := 'C:' + vSDKPartialFolder;
  58. end;
  59. finally
  60. Reg.Free;
  61. end;
  62. end;
  63. constructor TSDKUtil.Create;
  64. begin
  65. LocateSDK;
  66. end;
  67. end.