class_docstr: Defines a trait whose value must be a valid filesystem path.
class_docstr_tok: ["Defines","a","trait","whose","value","must","be","a","valid","filesystem","path","."]
docstr: Validate a value change.
docstr_tok: ["Validate","a","value","change","."]
code: def validate(self, objekt, name, value, return_pathlike=False):
      """Validate a value change."""
      try:
          value = Path(value)  # Use pathlib's validation
      except Exception:
          self.error(objekt, name, str(value))
  
      if self.exists:
          if not value.exists():
              self.error(objekt, name, str(value))
  
          if self._is_file and not value.is_file():
              self.error(objekt, name, str(value))
  
          if self._is_dir and not value.is_dir():
              self.error(objekt, name, str(value))
  
      if self.resolve:
          value = path_resolve(value, strict=self.exists)
  
      if not return_pathlike:
          value = str(value)
  
      return value
  
imports: from collections.abc import Sequence
  from traits import __version__
  import traits.api
  from traits.api import TraitType, Unicode
  from traits.trait_base import _Undefined
  from pathlib import Path
  from ...utils.filemanip import path_resolve
label_desc: Use image node_id 3 for calling the BasePath obj's underlying member method code with example usage: obj.validate(objekt, name, value, return_pathlike) and returns: value