RNA: move the read-only extension "directory" to RNA

This allows it to be exposed in the user interface when the
custom-directory is disabled without having to use a label which can't
handle non UTF-8 characters which file-paths can contain.
This commit is contained in:
Campbell Barton
2024-02-23 14:56:54 +11:00
parent 292b39b7f4
commit 86954de57a
4 changed files with 34 additions and 30 deletions

View File

@@ -1312,24 +1312,6 @@ class RenderEngine(StructRNA, metaclass=RNAMeta):
__slots__ = ()
class UserExtensionRepo(StructRNA):
__slots__ = ()
@property
def directory(self):
"""Return ``directory`` or a default path derived from the users scripts path."""
if self.use_custom_directory:
return self.custom_directory
import bpy
import os
# TODO: this should eventually be accessed via `bpy.utils.user_resource('EXTENSIONS')`
# which points to the same location (by default).
if (path := bpy.utils.resource_path('USER')):
return os.path.join(path, "extensions", self.module)
# Unlikely this is ever encountered.
return ""
class HydraRenderEngine(RenderEngine):
__slots__ = ()