DXPGlobals.pas 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // DXPGlobals
  2. {
  3. Globals for DXPExpert.<p>
  4. Licensed under MPL (http://www.mozilla.org/MPL/)
  5. Copyright 2003 - Eric Grange
  6. }
  7. unit DXPGlobals;
  8. interface
  9. uses Windows;
  10. var
  11. // FreePascal
  12. vFPC_RootPath : String;
  13. vFPC_BinaryPath : String;
  14. vFPC_TimeOut : Integer = 60*1000;
  15. vFPC_SourcePaths : String; // semicolon-separated
  16. vFPC_LibraryPaths : String; // semicolon-separated
  17. vFPC_ShowCompileLog : Boolean = False;
  18. procedure StoreDXPGlobals;
  19. procedure LoadDXPGlobals;
  20. // -----------------------------------------------------------------
  21. // -----------------------------------------------------------------
  22. // -----------------------------------------------------------------
  23. implementation
  24. // -----------------------------------------------------------------
  25. // -----------------------------------------------------------------
  26. // -----------------------------------------------------------------
  27. uses IniFiles, Dialogs;
  28. const
  29. cINI_FreePascal = 'FreePascal';
  30. cRootPath = 'RootPath';
  31. cBinaryPath = 'BinaryPath';
  32. cSourcePaths = 'SourcePaths';
  33. cLibraryPaths = 'LibraryPaths';
  34. cCompileLog = 'CompileLog';
  35. function IniFileName : String;
  36. begin
  37. SetLength(Result, 512);
  38. SetLength(Result, GetWindowsDirectory(PChar(Result), 510));
  39. Result:=Result+'\DXP.ini';
  40. end;
  41. // StoreDXPGlobals
  42. //
  43. procedure StoreDXPGlobals;
  44. var
  45. ini : TIniFile;
  46. begin
  47. ini:=TIniFile.Create(IniFileName);
  48. try
  49. ini.WriteString(cINI_FreePascal, cRootPath, vFPC_RootPath);
  50. ini.WriteString(cINI_FreePascal, cBinaryPath, vFPC_BinaryPath);
  51. ini.WriteString(cINI_FreePascal, cSourcePaths, vFPC_SourcePaths);
  52. ini.WriteString(cINI_FreePascal, cLibraryPaths, vFPC_LibraryPaths);
  53. ini.WriteBool (cINI_FreePascal, cCompileLog, vFPC_ShowCompileLog);
  54. finally
  55. ini.Free;
  56. end;
  57. end;
  58. // LoadDXPGlobals
  59. //
  60. procedure LoadDXPGlobals;
  61. var
  62. ini : TIniFile;
  63. begin
  64. try
  65. ini:=TIniFile.Create(IniFileName);
  66. try
  67. vFPC_RootPath:=ini.ReadString(cINI_FreePascal, cRootPath, '');
  68. vFPC_BinaryPath:=ini.ReadString(cINI_FreePascal, cBinaryPath, '');
  69. vFPC_SourcePaths:=ini.ReadString(cINI_FreePascal, cSourcePaths, '');
  70. vFPC_LibraryPaths:=ini.ReadString(cINI_FreePascal, cLibraryPaths,
  71. '$FPC\units\$TARGET;$FPC\units\$TARGET\rtl');
  72. vFPC_ShowCompileLog:=ini.ReadBool(cINI_FreePascal, cCompileLog, False);
  73. finally
  74. ini.Free;
  75. end;
  76. except
  77. ShowMessage(IniFileName+' incorrect!');
  78. end;
  79. end;
  80. end.