mirror of
https://github.com/yeongpin/cursor-free-vip.git
synced 2025-08-02 20:47:35 +08:00
fix: Update backup timestamp format in force update configuration
- Changed the variable name from 'time' to 'current_time' for clarity. - Updated the backup file naming to use the current timestamp correctly, ensuring accurate backup creation.
This commit is contained in:
parent
386ffa4568
commit
63fe39f2c1
@ -4,6 +4,7 @@ import configparser
|
|||||||
from colorama import Fore, Style
|
from colorama import Fore, Style
|
||||||
from utils import get_user_documents_path, get_default_chrome_path, get_linux_cursor_path
|
from utils import get_user_documents_path, get_default_chrome_path, get_linux_cursor_path
|
||||||
import shutil
|
import shutil
|
||||||
|
import datetime
|
||||||
|
|
||||||
EMOJI = {
|
EMOJI = {
|
||||||
"INFO": "ℹ️",
|
"INFO": "ℹ️",
|
||||||
@ -269,13 +270,12 @@ def force_update_config(translator=None):
|
|||||||
try:
|
try:
|
||||||
config_dir = os.path.join(get_user_documents_path(), ".cursor-free-vip")
|
config_dir = os.path.join(get_user_documents_path(), ".cursor-free-vip")
|
||||||
config_file = os.path.join(config_dir, "config.ini")
|
config_file = os.path.join(config_dir, "config.ini")
|
||||||
datetime = datetime.datetime
|
current_time = datetime.datetime.now()
|
||||||
time = datetime.now()
|
|
||||||
|
|
||||||
if os.path.exists(config_file):
|
if os.path.exists(config_file):
|
||||||
try:
|
try:
|
||||||
# create backup
|
# create backup
|
||||||
backup_file = f"{config_file}.bak.{time.strftime('%Y%m%d_%H%M%S')}"
|
backup_file = f"{config_file}.bak.{current_time.strftime('%Y%m%d_%H%M%S')}"
|
||||||
shutil.copy2(config_file, backup_file)
|
shutil.copy2(config_file, backup_file)
|
||||||
if translator:
|
if translator:
|
||||||
print(f"{Fore.CYAN}{EMOJI['INFO']} {translator.get('config.backup_created', path=backup_file) if translator else f'Backup created: {backup_file}'}{Style.RESET_ALL}")
|
print(f"{Fore.CYAN}{EMOJI['INFO']} {translator.get('config.backup_created', path=backup_file) if translator else f'Backup created: {backup_file}'}{Style.RESET_ALL}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user