Merge pull request #2682 from dhalbert/readonly-keyword-arg

add readonly= keyword to storage.remount where not already present
This commit is contained in:
Dan Halbert 2023-12-18 10:28:12 -05:00 committed by GitHub
commit cb55f61505
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 8 additions and 8 deletions

View file

@ -21,5 +21,5 @@ IO = digitalio.DigitalInOut(PIN)
IO.direction = digitalio.Direction.INPUT
IO.pull = digitalio.Pull.UP
if IO.value: # No connection
storage.remount('/', False) # Remount storage as read/write for painter
if IO.value: # No connection
storage.remount('/', readonly=False) # Remount storage as read/write for painter

View file

@ -20,4 +20,4 @@ switch.direction = digitalio.Direction.INPUT
switch.pull = digitalio.Pull.UP
# If the switch pin is connected to ground CircuitPython can write to the drive
storage.remount("/", switch.value)
storage.remount("/", readonly=switch.value)

View file

@ -13,4 +13,4 @@ switch.direction = digitalio.Direction.INPUT
switch.pull = digitalio.Pull.UP
# If the switch pin is connected to ground CircuitPython can write to the drive
storage.remount("/", switch.value)
storage.remount("/", readonly=switch.value)

View file

@ -11,4 +11,4 @@ switch.direction = digitalio.Direction.INPUT
switch.pull = digitalio.Pull.UP
# If the switch pin is connected to ground CircuitPython can write to the drive
storage.remount("/", switch.value)
storage.remount("/", readonly=switch.value)

View file

@ -28,4 +28,4 @@ if readonly:
print("OS has write access to CircuitPython drive")
else:
print("CircuitPython has write access to drive")
storage.remount("/", readonly)
storage.remount("/", readonly=readonly)

View file

@ -12,4 +12,4 @@ switch.pull = digitalio.Pull.UP
# If the D0 is connected to ground with a wire
# CircuitPython can write to the drive
storage.remount("/", switch.value)
storage.remount("/", readonly=switch.value)

View file

@ -45,7 +45,7 @@ def get_current_toml_file(enumerated_files):
# Erase settings.toml then write the contents of the new settings.toml file
def change_toml_file(toml_file):
try:
storage.remount("/", False)
storage.remount("/", readonly=False)
with open("settings.toml", "w") as settings:
settings.write("")
with open("settings.toml", "w") as settings, open(toml_file) as f: