Check input version

This commit is contained in:
Joey Wang
2023-03-22 13:26:35 +08:00
parent a8278e50dd
commit 9c2e314416
2 changed files with 12 additions and 0 deletions

View File

@@ -272,6 +272,9 @@ def parse_file(project: str, inp: str, version: str = '3') -> None:
def read_inp(project: str, inp: str, version: str = '3') -> bool: def read_inp(project: str, inp: str, version: str = '3') -> bool:
if version != '3' and version != '2':
version = '2'
if is_project_open(project): if is_project_open(project):
close_project(project) close_project(project)
@@ -293,6 +296,9 @@ def read_inp(project: str, inp: str, version: str = '3') -> bool:
def import_inp(project: str, cs: ChangeSet, version: str = '3') -> bool: def import_inp(project: str, cs: ChangeSet, version: str = '3') -> bool:
if version != '3' and version != '2':
version = '2'
if 'inp' not in cs.operations[0]: if 'inp' not in cs.operations[0]:
return False return False

View File

@@ -33,6 +33,9 @@ from .s27_backdrop import inp_out_backdrop
def dump_inp(project: str, inp: str, version: str = '3'): def dump_inp(project: str, inp: str, version: str = '3'):
if version != '3' and version != '2':
version = '2'
if not have_project(project): if not have_project(project):
return return
@@ -145,6 +148,9 @@ def dump_inp(project: str, inp: str, version: str = '3'):
def export_inp(project: str, version: str = '3') -> ChangeSet: def export_inp(project: str, version: str = '3') -> ChangeSet:
if version != '3' and version != '2':
version = '2'
if not have_project(project): if not have_project(project):
return ChangeSet() return ChangeSet()