Skip to content

Commit

Permalink
Fix Plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Firebladedoge229 authored Jun 2, 2024
1 parent 9e6a086 commit f7ea704
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions robloxstudiomanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,15 +622,17 @@ def enable_plugin(plugin):
]

for plugin_dir in plugin_dirs:
plugin_path = os.path.join(plugin_dir, plugin)
if os.path.exists(plugin_path):
for plugin in os.listdir(plugin_dir):
plugin_path = os.path.join(plugin_dir, plugin)
with open(plugin_path, 'r+b') as f:
content = f.read()

if content[-8:] == b"DISABLED":
f.seek(-8, os.SEEK_END)
index = content[24:].find(b"DISABLED")
if index == 0:
content = content[:24] + content[32:]
f.seek(0)
f.write(content)
f.truncate()
break

def disable_plugin(plugin):

Expand All @@ -645,9 +647,10 @@ def disable_plugin(plugin):
with open(plugin_path, 'r+b') as f:
content = f.read()

if b"DISABLED" not in content:
if b"DISABLED" not in content[24:]:
f.seek(0)
f.write(content + b"DISABLED")
new_content = content[:24] + b"DISABLED" + content[24:]
f.write(new_content)
break

def reset_states():
Expand All @@ -662,9 +665,13 @@ def reset_states():
plugin_path = os.path.join(plugin_dir, plugin)
with open(plugin_path, 'r+b') as f:
content = f.read()
if b"DISABLED" in content:
content = content.replace(b"DISABLED", b"")

index = content[24:].find(b"DISABLED")
if index != -1:
index += 24
content = content[:index] + content[index+8:]
f.seek(0)
f.truncate()
f.write(content)

def check_disabled_state(plugin):
Expand Down

0 comments on commit f7ea704

Please sign in to comment.