Skip to content

FileSystem Pro 1.0.4.0

Latest
Compare
Choose a tag to compare
@hbisneto hbisneto released this 26 Sep 10:01
cfc5f6b

We are thrilled to introduce the latest version of FileSystemPro, packed with new features and enhancements designed to improve your experience.

File

We are excited to introduce the latest update to our File module, designed to enhance your file management experience with improved functionality and performance. This module now includes several powerful functions designed to streamline your workflow and improve efficiency.

Added append_text function:

Function Addition: The append_text function was added to the File Module to handle appending text to files.
The function includes parameters for specifying the file path and the text to append.

Error Handling: Added error handling to manage cases where the file does not exist or cannot be accessed.

Return Value: The function now returns a boolean indicating the success or failure of the append operation.

Added get_extension function: (#62)

Function Addition: The get_extension function was added to the File Module to handle extracting the file extension from a given file path. The function includes parameters for specifying the file path and whether the extension should be returned in lowercase or uppercase.

Error Handling: The function does not include explicit error handling, assuming the provided file path is valid.

Return Value: The function returns the file extension as a string, either in lowercase or uppercase based on the lower parameter.

These updates enhance the function’s flexibility and ensure consistent handling of file extensions across different use cases

Changes in create function:

The default value of the encoding parameter has been changed from utf-8-sig to utf-8.
The utf-8-sig encoding includes a Byte Order Mark (BOM) at the beginning of the file, which can cause issues with some applications that do not expect it. The utf-8 encoding does not include a BOM, making it more universally compatible.

This update ensures better compatibility and avoids potential issues related to the BOM in UTF-8 encoded files.

Changes in get_files function: (#71)

  1. Parameters Added:
    • fullpath (bool): A new parameter that, when set to True, returns the full path of each file. Defaults to False.
    • extension (str): A new parameter that filters files by the specified extension. Defaults to None.
  2. Functionality Enhancements:
    • Full Path Retrieval: The function now has the capability to return the full path of files if fullpath is set to True.
    • Extension Filtering: The function can now filter and return only files with the specified extension if the extension parameter is provided.
  3. Backward Compatibility:
    • The function maintains backward compatibility by defaulting the new parameters (fullpath and extension) to False and None, respectively, ensuring that existing code using the old function signature will still work without modification.

These updates enhance the flexibility and functionality of the get_files function, making it more versatile for different use cases.


Directory

The Directory module has undergone several significant updates to enhance its functionality and usability. Here are the key changes:

Changes in delete function:

The recent change in the delete function of the Directory module includes a modification to the condition that checks if a directory exists. Previously, the function used os.path.exists(path) to check for the directory’s existence. This has been updated to use the exists(path) function instead.

This change ensures that the custom exists function is used consistently throughout the module.

Changes in exists function:

The exists function has been simplified for better readability and efficiency. The else statement has been removed, as it is redundant. Now, if os.path.isdir(path) returns True, the function will return True. If not, it will directly return False without needing an else block.

Changes in get_directories function:

The get_directories function in the code has been updated to include an additional parameter fullpath.

  • New Parameter: fullpath (default is False) When set to True, the function returns the full path of each directory.

  • Conditional Logic: Added logic to append the full path of directories to the list if fullpath is True.

These changes enhance the function’s flexibility by allowing it to return either directory names or full paths based on the fullpath parameter.


Wrapper

With this update, the Wrapper module now offers a more convenient method for handling ZIP files, enhancing its overall functionality and user experience.

Added read_zip_file_contents function: (#65)

This function is designed to read the contents of a ZIP file.

The function aims to simplify the process of extracting and reading files within a ZIP archive, making it easier for users to handle ZIP files within the FileSystemPro library.

The new function takes a single parameter, zip_filename, which is the path to the ZIP file. It reads the contents of the ZIP file and returns them in a structured format.

Users can call this function to quickly access the contents of a ZIP file without manually handling the extraction process.

These changes enhance the functionality of the Wrapper module by providing a convenient method for working with ZIP files.


Please take a moment to familiarize yourself with these changes.
Let's continue to work together to improve FileSystem Pro!

Bisneto.