-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/brave cache #76
Open
jdarowski
wants to merge
4
commits into
zafarella:master
Choose a base branch
from
jdarowski:feature/brave-cache
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,6 +201,54 @@ move_chrome_chanary_cache() | |
fi | ||
} | ||
|
||
# | ||
# Brave Cache | ||
# | ||
|
||
# Create a directory for Brave in the ramdisk | ||
make_brave_dir() | ||
{ | ||
/bin/mkdir -pv "${USERRAMDISK}"/Brave-Browser | ||
} | ||
|
||
# Move existing Brave cache to ramdisk | ||
move_brave_cache() | ||
{ | ||
/bin/mkdir -p /tmp/Brave-Browser | ||
/bin/mv ~/Library/Caches/BraveSoftware/Brave-Browser/* /tmp/Brave-Browser | ||
/bin/mv /tmp/Brave-Browser/* "${USERRAMDISK}"/Brave-Browser | ||
/bin/rm -rf ~/Library/Caches/BraveSoftware/Brave-Browser | ||
|
||
} | ||
|
||
# Link Brave cache to ramdisk | ||
link_brave_dir() | ||
{ | ||
/bin/ln -v -s "${USERRAMDISK}"/Brave-Browser ~/Library/Caches/BraveSoftware/Brave-Browser | ||
} | ||
|
||
# Check what to do with brave | ||
check_brave_cache() | ||
{ | ||
if [ -d "/Users/${USER}/Library/Caches/BraveSoftware/Brave-Browser" ]; then | ||
if user_response "${MSG_PROMPT_FOUND}" 'Brave'"${MSG_MOVE_CACHE}" ; then | ||
close_app "Brave Browser" | ||
make_brave_dir | ||
move_brave_cache | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. body of the function could be just added here. |
||
link_brave_dir | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. consider replacing this line with line 225:
it is used once only, does not needs to be a func |
||
/bin/rm -rf /tmp/Brave-Browser | ||
# and let's create a flag for next run that we moved the cache. | ||
echo ""; | ||
fi | ||
elif [ -L "/Users/${USER}/Library/Caches/BraveSoftware/Brave-Browser" ]; then | ||
echo "Brave cache already moved" | ||
close_app "Brave Browser" | ||
make_brave_dir | ||
else | ||
echo "No Brave folder has been found. Skipping." | ||
fi | ||
} | ||
|
||
# | ||
# Safari Cache | ||
# | ||
|
@@ -386,6 +434,7 @@ main() { | |
move_safari_cache | ||
move_idea_cache | ||
move_ideace_cache | ||
check_brave_cache | ||
# create intermediate folder for intellij projects output | ||
create_intermediate_folder_for_intellij_projects | ||
move_itunes_cache | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR.
What if you simplify adding this browser by joining all the separate functions you did into one as it is done for other browsers, i.e chrome?
The
ln
behaviour should not be changing, it will break many things for them I suspect.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I broke it up into several functions because I needed to do several more than once to prepare for previously-enabled cache. If you want me to do it I can make it a single function and... copy and paste some code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And speaking of the
ln
behaviour: it cost me a lot of time to figure out the problem. I was not expecting it as system tools usually behave as expected