| 145 | |
| 146 | @classmethod |
| 147 | def get_location(cls) -> Optional[Path]: |
| 148 | if cls.DISABLE_CACHE: |
| 149 | return None |
| 150 | |
| 151 | if cls.__location is None: |
| 152 | c = os.environ.get("AURA_CACHE_LOCATION") or config.CFG["aura"].get("cache_location") |
| 153 | if c: |
| 154 | c = Path(c).expanduser().resolve() |
| 155 | logger.debug(f"Cache location set to {c}") |
| 156 | |
| 157 | if not c.exists(): |
| 158 | c.mkdir(parents=True) |
| 159 | cls.__location = c |
| 160 | |
| 161 | return cls.__location |
| 162 | |
| 163 | def save_metadata(self): |
| 164 | self.metadata_location.write_text(dumps(self.metadata)) |