SkuldNorniern / fluere

Fluere is a powerful and versatile tool designed for network monitoring and analysis. It is capable of capturing network packets in pcap format and converting them into NetFlow data, providing a comprehensive view of network traffic. It also Provides Terminal User Interface.
Apache License 2.0
37 stars 3 forks source link

Fix directory creation issue on macOS #77

Closed sweep-ai[bot] closed 1 year ago

sweep-ai[bot] commented 1 year ago

PR Feedback: πŸ‘Ž

Description

This PR fixes the issue where directory creation fails on macOS with Intel architecture. The error message "Failed to create directory at "/home//.config/fluere": Operation not supported (os error 45)" indicates that the program is trying to create a directory at a location that is not supported by the operating system.

The issue is resolved by modifying the home_config_path() function in the init.rs file. The function now correctly handles different operating systems by using the cfg! macro to check the target OS at compile time. If the target OS is macOS, the dirs::home_dir() function is used to get the home directory instead of hardcoding the path.

Summary of Changes

Please review and merge this PR to fix the directory creation issue on macOS.

Fixes #74.


πŸŽ‰ Latest improvements to Sweep:


πŸ’‘ To get Sweep to edit this pull request, you can:

Summary by CodeRabbit

sweep-ai[bot] commented 1 year ago

Sandbox Executions

sweep-ai[bot] commented 1 year ago

Apply Sweep Rules to your PR?

coderabbitai[bot] commented 1 year ago

[!IMPORTANT]

Auto Review Skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Walkthrough

The change introduces a conditional check in the fluere-config/src/init.rs file to handle different scenarios for obtaining the configuration path based on the operating system and the presence of sudo_user.

Changes

File Change Summary
fluere-config/src/init.rs Introduced a conditional check for the operating system. If macOS, the home_config_path() function returns the config_dir() function result. If sudo_user is set, the path is constructed using the user's home directory and the .config directory.

Assessment against linked issues (Beta)

Objective Addressed Explanation
Fix the bug where the system fails to create a directory at a specified config location, resulting in an OS error 45 (#74) βœ… The changes in the init.rs file introduce a conditional check to handle different scenarios for obtaining the configuration path, which should address the issue of failing to create a directory.

Poem

πŸ‡ Hopping through the code, a rabbit's delight,

Fixing bugs in the cool November night. πŸŒ™

With each line of code, we make things right,

In the world of software, we ignite a light. πŸ’‘

Celebrating this day, when in 1860, Lincoln was in sight, 🎩

As the president-elect, leading with might.

So here's to the coders, working day and night,

Making the digital world bright, byte by byte. 🌟


Tips ### Chat with CodeRabbit Bot (`@coderabbitai`) - If you reply to a *review comment* from CodeRabbit, the bot will automatically respond. - To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment - Note: Review comments are made on code diffs or files, not on the PR overview. - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai help` to get help. - `@coderabbitai resolve` to resolve all the CodeRabbit review comments. Note: For conversation with the bot, please use the review comments on code diffs or files. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json). - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json`
SkuldNorniern commented 1 year ago

@coderabbitai review

sweep-ai[bot] commented 1 year ago

πŸš€ Wrote Changes

I wasn't able to make changes. This could be due to an unclear request or a bug in my code. As a reminder, comments on a file only modify that file. Comments on a PR (at the bottom of the "conversation" tab) can modify the entire PR. Please try again or contact us on Discord

SkuldNorniern commented 1 year ago

can you add some unit tests for the functions, per OSs

sweep-ai[bot] commented 1 year ago

❌ Failed to make changes

Please join our Discord to report this issue.

SkuldNorniern commented 1 year ago

can you add some unit tests for the functions under fluere-config/src/init.rs

sweep-ai[bot] commented 1 year ago

❌ Failed to make changes

Please join our Discord to report this issue.