textual_fspicker.safe_tests
Support functions for doing safe filesystem tests.
This module provides some functions for performing tests on entries in the
filesystem in a way that swallows some errors that we don't want causing the
application to crash on. In most cases this is going to be a
PermissionError
, which for UI stuff is better ignored
than raised.
is_dir
is_dir(location)
A safe version of is_dir
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Path
|
The location to test. |
required |
Returns:
Type | Description |
---|---|
bool
|
This function swallows PermissionError
and just
returns that the location isn't a directory.
is_file
is_file(location)
A safe version of is_file
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Path
|
The location to test. |
required |
Returns:
Type | Description |
---|---|
bool
|
This function swallows PermissionError
and just
returns that the location is a file.
is_symlink
is_symlink(location)
A safe version of is_symlink
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Path
|
The location to test. |
required |
Returns:
Type | Description |
---|---|
bool
|
This function swallows PermissionError
and just
returns that the location isn't a symlink.