diff --git a/.github/workflows/test_app_dir_path_finder.yaml b/.github/workflows/test_app_dir_path_finder.yaml index 277d34dc1..27b7d7cd8 100644 --- a/.github/workflows/test_app_dir_path_finder.yaml +++ b/.github/workflows/test_app_dir_path_finder.yaml @@ -32,11 +32,12 @@ jobs: - name: Run tests run: | + python -m pip install --upgrade pyobjc python -m pip install --upgrade cengal_light[cengal__file_system__app_fs_structure__app_dir_path] python ./cengal/file_system/app_fs_structure/app_dir_path/versions/v_0/development/print_app_dirs.py test_wheels__macos_arm64__cpython: - name: Build Cengal Shell wheels on ${{ matrix.os }} for CPython ${{ matrix.python-version }} + name: Test App Dir Path Finder on ${{ matrix.os }} for CPython ${{ matrix.python-version }} runs-on: ${{ matrix.os }} strategy: matrix: @@ -60,11 +61,12 @@ jobs: - name: Run tests run: | + python -m pip install --upgrade pyobjc python -m pip install --upgrade cengal_light[cengal__file_system__app_fs_structure__app_dir_path] python ./cengal/file_system/app_fs_structure/app_dir_path/versions/v_0/development/print_app_dirs.py # test_wheels__macos_x64__pypy: - # name: Build Cengal Shell wheels on ${{ matrix.os }} for PyPy ${{ matrix.python-version }} + # name: Test App Dir Path Finder on ${{ matrix.os }} for PyPy ${{ matrix.python-version }} # runs-on: ${{ matrix.os }} # strategy: # matrix: @@ -92,7 +94,7 @@ jobs: # python ./cengal/file_system/app_fs_structure/app_dir_path/versions/v_0/development/print_app_dirs.py # test_wheels__macos_arm64__pypy: - # name: Build Cengal Shell wheels on ${{ matrix.os }} for PyPy ${{ matrix.python-version }} + # name: Test App Dir Path Finder on ${{ matrix.os }} for PyPy ${{ matrix.python-version }} # runs-on: ${{ matrix.os }} # strategy: # matrix: @@ -145,6 +147,7 @@ jobs: - name: Run tests run: | + python -m pip install --upgrade pywin32 python -m pip install --upgrade cengal_light[cengal__file_system__app_fs_structure__app_dir_path] python ./cengal/file_system/app_fs_structure/app_dir_path/versions/v_0/development/print_app_dirs.py shell: cmd @@ -205,6 +208,7 @@ jobs: - name: Run tests run: | + python -m pip install --upgrade pywin32 python -m pip install --upgrade cengal_light[cengal__file_system__app_fs_structure__app_dir_path] python ./cengal/file_system/app_fs_structure/app_dir_path/versions/v_0/development/print_app_dirs.py shell: cmd @@ -219,19 +223,15 @@ jobs: - image: "quay.io/pypa/manylinux2014_x86_64" package-manager: "yum" python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] - container: ${{ matrix.image }} + container: + image: ${{ matrix.image }} + options: -v ${{ github.workspace }}:/github/workspace --workdir /github/workspace steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} run: | - if [ "${{ matrix.package-manager }}" = "yum" ]; then - yum install -y python${{ matrix.python-version }} python${{ matrix.python-version }}-pip - elif [ "${{ matrix.package-manager }}" = "apk" ]; then - apk add --update python3 - ln -sf python3 /usr/bin/python - python -m ensurepip - fi + yum install -y python${{ matrix.python-version }} python${{ matrix.python-version }}-pip python -m pip install --upgrade pip setuptools wheel - name: Install basic Python dependencies diff --git a/cengal/file_system/app_fs_structure/app_dir_path/versions/v_0/development/print_app_dirs.py b/cengal/file_system/app_fs_structure/app_dir_path/versions/v_0/development/print_app_dirs.py index eac22a6b3..014cc7bff 100644 --- a/cengal/file_system/app_fs_structure/app_dir_path/versions/v_0/development/print_app_dirs.py +++ b/cengal/file_system/app_fs_structure/app_dir_path/versions/v_0/development/print_app_dirs.py @@ -32,20 +32,52 @@ # __status__ = "Production" -from cengal.file_system.app_fs_structure.app_dir_path import AppDirectoryType, AppDirPath - - -def main(): - for dir_type in AppDirectoryType: - adp: AppDirPath = AppDirPath() - print(f'<<< {dir_type.name} >>>') - print(adp(dir_type, with_structure=False, ensure_dir=False)) - print(adp(dir_type, with_structure=True, ensure_dir=False)) - print(adp(dir_type, 'test_app', with_structure=False, ensure_dir=False)) - print(adp(dir_type, 'test_app', with_structure=True, ensure_dir=False)) - print() - - print('Done.') +from cengal.system import OS_TYPE + +if 'Darwin' == OS_TYPE: + from Foundation import NSSearchPathForDirectoriesInDomains + from Foundation import NSDocumentDirectory, NSUserDomainMask + + def get_documents_directory(): + # Perform the search + paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, True) + if paths: + # Typically, you're interested in the first result + return paths[0] + else: + return None + + # Example usage + documents_path = get_documents_directory() + print("Documents Directory:", documents_path) + + def get_caches_directory(): + # Perform the search + paths = NSSearchPathForDirectoriesInDomains(13, 1, True) + if paths: + # Typically, you're interested in the first result + return paths[0] + else: + return None + + # Example usage + caches_path = get_caches_directory() + print("Caches Directory:", caches_path) +else: + from cengal.file_system.app_fs_structure.app_dir_path import AppDirectoryType, AppDirPath + + + def main(): + for dir_type in AppDirectoryType: + adp: AppDirPath = AppDirPath() + print(f'<<< {dir_type.name} >>>') + print(adp(dir_type, with_structure=False, ensure_dir=False)) + print(adp(dir_type, with_structure=True, ensure_dir=False)) + print(adp(dir_type, 'test_app', with_structure=False, ensure_dir=False)) + print(adp(dir_type, 'test_app', with_structure=True, ensure_dir=False)) + print() + + print('Done.') if '__main__' == __name__: