You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 maanden geleden
12345678910111213141516171819202122232425262728293031323334353637383940
  1. import os
  2. from cld import *
  3. from fs_aux import *
  4. from ht_Context import *
  5. # Extract directory from config path
  6. #
  7. # Conditions:
  8. # 1. Config path has just been set
  9. @cld_by_value
  10. def fs_locateConfigDir(
  11. c: ht_Context
  12. ) -> ht_Context:
  13. if (
  14. c.recentField == "cfgPath"
  15. ):
  16. c.cfgDir = os.path.dirname(c.cfgPath)
  17. c.recentField = "cfgDir"
  18. return c
  19. c.recentField = "none"
  20. return c
  21. # Read config file contents
  22. #
  23. # Conditions:
  24. # 1. Config path has just been set
  25. @cld_by_value
  26. def fs_readConfig(
  27. c: ht_Context
  28. ) -> ht_Context:
  29. if (
  30. c.recentField == "cfgPath"
  31. ):
  32. c.cfgContents = fs_aux_readFile(c.cfgPath)
  33. c.recentField = "cfgContents"
  34. return c
  35. c.recentField = "none"
  36. return c