Willy-JL / F95Checker

GNU General Public License v3.0
101 stars 16 forks source link

Refactor File Writing to Use `data_path` for Logs #124

Closed nazdridoy closed 4 months ago

nazdridoy commented 5 months ago

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

Impact

nazdridoy commented 5 months ago

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

r37r05p3C7 commented 5 months ago

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

nazdridoy commented 5 months ago

i just can't ignore šŸ˜‡

I poured my heart and soul into this tool

nazdridoy commented 5 months ago

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