projectparser.pas 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. {
  2. projectparser.pas
  3. Parses the project file
  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 projectparser;
  18. {$ifdef fpc}
  19. {$mode delphi}{$H+}
  20. {$endif}
  21. interface
  22. uses
  23. Classes, SysUtils, IniFiles,
  24. constants;
  25. type
  26. { TProject }
  27. TProject = class(TObject)
  28. public
  29. opts: TMkSymbianOptions;
  30. { Main section }
  31. ExeName, Language: string;
  32. { FPC section }
  33. CompilerPath, RTLUnitsDir: string;
  34. { UIDs section }
  35. UID2, UID3: string;
  36. { Files section }
  37. MainSource, MainSourceNoExt, MainResource: string;
  38. public
  39. procedure ParseFile;
  40. end;
  41. var
  42. vProject: TProject;
  43. implementation
  44. { TProject }
  45. {*******************************************************************
  46. * TProject.ParseFile ()
  47. *
  48. * DESCRIPTION: Parses the project file
  49. *
  50. * PARAMETERS: None
  51. *
  52. * RETURNS: Nothing
  53. *
  54. *******************************************************************}
  55. procedure TProject.ParseFile;
  56. var
  57. IniFile: TIniFile;
  58. begin
  59. IniFile := TIniFile.Create(opts.ProjectFile);
  60. try
  61. ExeName := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_ExeName, 'default.exe');
  62. Language := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_Language, 'Pascal');
  63. CompilerPath := IniFile.ReadString(STR_PRJ_FPC, STR_PRJ_CompilerPath, 'C:\Programas\fpc21\compiler\ppc386.exe');
  64. RTLUnitsDir := IniFile.ReadString(STR_PRJ_FPC, STR_PRJ_RTLUnitsDir, 'C:\Programas\fpc21\rtl\units\i386-symbian\');
  65. UID2 := IniFile.ReadString(STR_PRJ_UIDs, STR_PRJ_UID2, '0x100039CE');
  66. UID3 := IniFile.ReadString(STR_PRJ_UIDs, STR_PRJ_UID3, '0xE1000002');
  67. MainSource := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_MainSource, 'default.pas');
  68. MainSourceNoExt := ExtractFileExt(MainSource);
  69. MainResource := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_MainResource, 'default.rss');
  70. finally
  71. IniFile.Free;
  72. end;
  73. end;
  74. end.