Skip to content

Commit

Permalink
GA
Browse files Browse the repository at this point in the history
  • Loading branch information
FI-Mihej committed Apr 1, 2024
1 parent d67f933 commit 23afc80
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 22 deletions.
28 changes: 11 additions & 17 deletions .github/workflows/test_app_dir_path_finder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -226,30 +226,24 @@ jobs:

steps:
- uses: actions/checkout@v4
# Prepare the Docker container without starting it
- name: Create Docker container

# Create Docker container with a command that keeps it running
- name: Create and start Docker container
id: create-container
run: |
CONTAINER_ID=$(docker create -w /github/workspace --entrypoint /bin/bash ${{ matrix.image }})
CONTAINER_ID=$(docker create -it -w /github/workspace ${{ matrix.image }} /bin/bash -c "tail -f /dev/null")
docker start $CONTAINER_ID
echo "::set-output name=id::$CONTAINER_ID"
shell: bash
# Copy the checked-out repository into the Docker container
# Copy workspace to the running container
- name: Copy workspace to container
run: |
docker cp . ${{ steps.create-container.outputs.id }}:/github/workspace
# Start the container and keep it running so subsequent commands can execute within it
- name: Start container
run: |
docker start ${{ steps.create-container.outputs.id }}
# Execute commands within the Docker container
run: docker cp . ${{ steps.create-container.outputs.id }}:/github/workspace

# Proceed with setting up Python and other steps within the container
- name: Set up Python in the Docker container
run: |
docker exec ${{ steps.create-container.outputs.id }} yum install -y python${{ matrix.python-version }} python${{ matrix.python-version }}-pip
docker exec ${{ steps.create-container.outputs.id }} python -m pip install --upgrade pip setuptools wheel
docker exec ${{ steps.create-container.outputs.id }} yum install -y python3.8 python3.8-pip
docker exec ${{ steps.create-container.outputs.id }} python3.8 -m pip install --upgrade pip setuptools wheel
# Continue with your setup and test execution steps
- name: Install basic Python dependencies in the Docker container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def main():
from cengal.ctypes_tools.types import GUID
from cengal.ctypes_tools.constants import KnownfolderidConstants, S_OK
from cengal.ctypes_tools.function_prototypes import SHGetKnownFolderPath as proto_SHGetKnownFolderPath, CoTaskMemFree
from cengal.ctypes_tools.constants import KnownfolderidConstants
from cengal.file_system.directory_manager import ensure_dir as ensure_dir_exists
from cengal.ctypes_tools.tools import cwfunc_def
from typing import Union, Sequence, Any
Expand All @@ -91,11 +92,10 @@ def main():
HRESULT
)

def get_known_folder_path(folder_id):
def get_known_folder_path(dir_guid):
# Convert string representation of the GUID to a GUID object
folder_id_guid = UUID(folder_id).bytes_le
path_ptr = POINTER(c_wchar_p)()
hresult = SHGetKnownFolderPath(byref(GUID(folder_id_guid)), 0, None, byref(path_ptr))
hresult = SHGetKnownFolderPath(byref(dir_guid), 0, None, byref(path_ptr))
if hresult != 0:
raise WinError(hresult)
try:
Expand All @@ -108,8 +108,7 @@ def get_known_folder_path(folder_id):

# Example usage
# Use the GUID for the folder you're interested in, for example, the Documents folder
folder_id = 'FDD39AD0-238F-46AF-ADB4-6C85480369C7'
path = get_known_folder_path(folder_id)
path = get_known_folder_path(KnownfolderidConstants.FOLDERID_Documents)
print(f'Path: {path}')
else:
from cengal.file_system.app_fs_structure.app_dir_path import AppDirectoryType, AppDirPath
Expand Down

0 comments on commit 23afc80

Please sign in to comment.