oss-slu / Mouser

GNU General Public License v3.0
1 stars 7 forks source link

Fixing incorrect password error #176

Closed stanleyyang2001 closed 8 months ago

stanleyyang2001 commented 9 months ago

Fixes #168

What was changed?

Nothing was changed currently, but problems were identified. There are two possible errors that could occur when trying to access protected experiment files:

Why was it changed?

The error arose because whenever a protected file was opened, a temporary file with all method that the actual file would have is created in a temporary mouser directory, and the application would use that file instead of the actual file. This means that the application is creating duplicate files in the temporary directory, which takes up the memory of the PC. Therefore, the original approach to reduce the resources use was to check if a duplicate file already exists and if it does, the application will remove the file. However, every time the temporary file is created it is connected to the database, and there's no method that's currently implemented to disconnect a mouser file from the database when it's not being used by the mouser application. This makes it so that even if the user moves on to another mouser file, the database is still connected to the temporary file, and evoke the error when the application tries to remove it.

How was it changed? I added a check in main.py that checks if there's a "Mouser" directory in the AppData/Local/Temp, if there is, then the application will delete that directory. I also added a check so that if there's a temporary file already existed in the temporary directory, then there's no need to create a new temporary file and writes data to it since we can use the existing file.

loganwyas commented 8 months ago

@stanleyyang2001 What is the progress on making the requested changes?

stanleyyang2001 commented 8 months ago

@loganwyas it's done, only review is required

loganwyas commented 8 months ago

@stanleyyang2001 I made a comment 12 days ago about a hardcoded directory being used, and I notice that it hasn't been fixed.

stanleyyang2001 commented 8 months ago

@loganwyas odd, I didn't find the comment. Can you point out the directory with the problem again?

loganwyas commented 8 months ago

Line 99 in experiment_pages/experiment/experiment_menu_ui.py

stanleyyang2001 commented 8 months ago

@loganwyas It's fixed now, still some hard code left since the protected file opened by mouser doesn't points to the actual protected file.