Last active
June 20, 2023 14:40
-
-
Save Neradoc/7074c75bb7a5b6b357fd3354ea125cd4 to your computer and use it in GitHub Desktop.
UOS compatibility for mpremote compatibility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import storage | |
from os import * | |
def get_mount_for(path): | |
path = path.rstrip("/") | |
if path[0] != "/": | |
path = os.getcwd() + "/" + path | |
while len(path) > 0: | |
try: | |
return storage.getmount(path) | |
except OSError: | |
pos = path.rfind("/") | |
path = path[:pos] | |
return None | |
def ilistdir(path): | |
mount = get_mount_for(path) | |
return mount.ilistdir(path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment