File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import configparser
22import ipaddress
3+ import platform
34import shutil
45import sys
56from os import mkdir
@@ -170,11 +171,23 @@ def reflect_table(self, table):
170171
171172 return reflected_table
172173 except (NoInspectionAvailable , NoSuchTableError , ValueError ) as e :
174+ commands_platform = {
175+ "Windows" : [
176+ f"cmd /c copy { self .db_path } %USERPROFILE%\\ nxc_{ self .protocol .lower ()} .bak" ,
177+ f"del { self .db_path } "
178+ ],
179+ "Linux" : [
180+ f"cp { self .db_path } ~/nxc_{ self .protocol .lower ()} .bak" ,
181+ f"rm -f { self .db_path } "
182+ ]
183+ }
184+ copy_command = commands_platform ["Windows" ][0 ] if platform .system () == "Windows" else commands_platform ["Linux" ][0 ]
185+ delete_command = commands_platform ["Windows" ][1 ] if platform .system () == "Windows" else commands_platform ["Linux" ][1 ]
173186 nxc_logger .fail (f"Schema mismatch detected for table '{ table .__tablename__ } ' in protocol '{ self .protocol } '" )
174187 nxc_logger .debug (e )
175188 nxc_logger .fail ("This is probably because a newer version of nxc is being run on an old DB schema." )
176- nxc_logger .fail (f"Optionally save the old DB data (`cp { self . db_path } ~/nxc_ { self . protocol . lower () } .bak `)" )
177- nxc_logger .fail (f"Then remove the { self .protocol } DB (`rm -f { self . db_path } `) and run nxc to initialize the new DB" )
189+ nxc_logger .fail (f"Optionally save the old DB data (`{ copy_command } `)" )
190+ nxc_logger .fail (f"Then remove the { self .protocol } DB (`{ delete_command } `) and run nxc to initialize the new DB" )
178191 sys .exit ()
179192
180193 def shutdown_db (self ):
You can’t perform that action at this time.
0 commit comments