This repository has been archived by the owner on Aug 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
RCOI.pyw
52 lines (44 loc) · 1.81 KB
/
RCOI.pyw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Modules required for this to function
import requests
import json
import os
import glob
import sys
import winshell
import shutil
import ctypes
def show_popup(message, title):
ctypes.windll.user32.MessageBoxW(0, message, title, 0)
# Obtains latest URL
RCOu_url = "https://hdboye.github.io/curRCO/cur.txt"
RCOu = requests.get(RCOu_url,headers={'Cache-Control': 'no-cache'})
RCOu_text = RCOu.text.strip()
if(RCOu.text == "xxx"):
show_popup('We\'re sorry, there is currently no reliable source to get RCO from. Please check back later!', 'No reliable source')
sys.exit()
# Obtains latest version of ClientAppSettings.json
RCO = requests.get(RCOu_text)
print(RCO.text)
# Finds the directory to RCO
user = os.getlogin()
RobloxVersionDir = rf"C:\Users\{user}\AppData\Local\Roblox\Versions"
LatestRobloxVersionDir = max(glob.glob(os.path.join(RobloxVersionDir, "version-*")), key=os.path.getmtime)
RobloxClientSettingsDir = os.path.join(LatestRobloxVersionDir, "ClientSettings", "ClientAppSettings.json")
# If RCO isn't installed, it will be installed
if not os.path.exists(os.path.dirname(RobloxClientSettingsDir)):
os.makedirs(os.path.dirname(RobloxClientSettingsDir))
# Latest version of RCO writes/overwrites current ClientAppSettings.json
with open(RobloxClientSettingsDir, "w") as f:
json.dump(json.loads(RCO.text), f, indent=0)
# Informs user that RCO has been updated/installed and the directory
print("New data has been written to", RobloxClientSettingsDir)
# Auto-startup stuff (im not good at comments)
try:
path = winshell.startup()
try:
shutil.copy2(os.path.realpath(sys.executable),path)
except:
print('ok nvm')
show_popup('RCO is now up-to-date! Enjoy!', 'Success!')
except OSError as err:
show_popup('An error has occured. Please report this to the github. ' + err, 'whoops')