Cleanup: Remove backwards-compatible code
Since we aren't interested in backwards compatibility this early in development, let's remove those code chunks to keep the code shorter.
This commit is contained in:
@@ -19,9 +19,6 @@
|
||||
|
||||
import json
|
||||
import os
|
||||
import shlex
|
||||
|
||||
from .game_data_to_json import game_data_to_json
|
||||
|
||||
|
||||
def get_games(game_ids=None):
|
||||
@@ -42,28 +39,8 @@ def get_games(game_ids=None):
|
||||
game_files = os.listdir(games_dir)
|
||||
|
||||
for game in game_files:
|
||||
with open(os.path.join(games_dir, game), "r+") as open_file:
|
||||
with open(os.path.join(games_dir, game), "r") as open_file:
|
||||
data = json.loads(open_file.read())
|
||||
|
||||
# Convert any outdated JSON values to our newest data format.
|
||||
needs_rewrite = False
|
||||
if "executable" in data and isinstance(data["executable"], str):
|
||||
needs_rewrite = True
|
||||
try:
|
||||
# Use shell parsing to determine what the individual components are.
|
||||
executable_split = shlex.split(
|
||||
data["executable"], comments=False, posix=True
|
||||
)
|
||||
except:
|
||||
# Fallback: Split once at earliest space (1 part if no spaces, else 2 parts).
|
||||
executable_split = data["executable"].split(" ", 1)
|
||||
data["executable"] = executable_split
|
||||
|
||||
if needs_rewrite:
|
||||
open_file.seek(0)
|
||||
open_file.truncate()
|
||||
open_file.write(game_data_to_json(data))
|
||||
|
||||
open_file.close()
|
||||
|
||||
games[data["game_id"]] = data
|
||||
|
||||
Reference in New Issue
Block a user