F95Checker icon indicating copy to clipboard operation
F95Checker copied to clipboard

Refactor File Writing to Use `data_path` for Logs

Open nazdridoy opened this issue 1 year ago • 4 comments

Description

This pull request introduces changes to the way f95checker handles file writing, specifically for log files. Previously, log files were being written directly to globals.self_path, which could lead to clutter and issues in environments where self_path is read-only or has restrictive permissions (such as when packaged for AUR). To address this, I've refactored the code to ensure all log files are neatly organized in a logs subfolder within globals.data_path. This change keeps the executable path clean, avoids clutter, and ensures compatibility with read-only or restricted permission environments.

Changes

  1. globals.py Adjustment: Ensured that a logs subfolder is created within globals.data_path if it doesn't already exist. This provides a dedicated space for storing log files.

  2. Refactored File Writing Operations:

    • Adjusted all instances where log files (login_broken.bin, check_broken.bin, notifs_broken.bin, update_broken.bin, and log.txt) were being written to globals.self_path. These files are now correctly written to the logs subfolder within globals.data_path.

Motivation

The main motivation behind these changes is to maintain a clean executable path and to address potential issues with file writing permissions, especially when the application is packaged for distribution (e.g., AUR). By organizing log files into a dedicated subfolder within globals.data_path, we not only avoid clutter but also circumvent the complications arising from read-only or restricted permission scenarios.

Testing

  • I've done some manual testing to ensure that log files are correctly written to the new location.
  • Verified that the application behaves as expected in environments where self_path is read-only.
  • Ensured backward compatibility and that existing functionalities are not affected by these changes.

Impact

  • Users: This change is transparent to users but results in a cleaner application structure and potentially avoids issues related to file writing permissions.
  • Developers: Developers need to be aware of the new log file location for debugging or log analysis purposes.

nazdridoy avatar Feb 03 '24 18:02 nazdridoy

ref: https://github.com/Willy-JL/F95Checker/pull/122

nazdridoy avatar Feb 03 '24 18:02 nazdridoy

oh man, when the final appimage pr drops, it will probably have an entire research paper attached :smiley:

r37r05p3C7 avatar Feb 03 '24 20:02 r37r05p3C7

i just can't ignore 😇

I poured my heart and soul into this tool

nazdridoy avatar Feb 03 '24 22:02 nazdridoy

oh and i hate when people submit pull requests with a 315-line edit spread across 69 files and their PR description is simply

'Updated some files to have this.' 😑

A pull request should provide as much detail as possible. Although, I suppose my PR template might be overly elaborate for a modest +10/-6 PR... XD icons8-mustache-emoji-50

nazdridoy avatar Feb 03 '24 22:02 nazdridoy