Skip to content

Commit

Permalink
fix: move IPFS_PATH to ~/.ipfs-desktop (#1079)
Browse files Browse the repository at this point in the history
This fixes the issue caused by having IPFS_PATH in the same
directory as the app code. That would fail in multiple circunstances:

1. When the app was updated, IPFS_PATH would get deleted.
2. macOS gatekeeper paths randomization for security purposes creates
a read-only directory for the app files when the app isn't executed
from secure locations (such as ~/Applications) and it would make it fail.

License: MIT
Signed-off-by: Henrique Dias <[email protected]>
hacdias authored Sep 4, 2019
1 parent 90d0e95 commit 0d0f71a
Showing 4 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -7,4 +7,3 @@ assets/webui
*.nupkg
*.bak
assets/build/snap-hooks
IPFS_PATH
4 changes: 2 additions & 2 deletions src/daemon/index.js
Original file line number Diff line number Diff line change
@@ -139,8 +139,8 @@ export default async function (ctx) {
}

function writeIpfsPath (path) {
fs.writeFileSync(
join(__dirname, '../ipfs-on-path/scripts/IPFS_PATH')
fs.outputFileSync(
join(app.getPath('home'), './.ipfs-desktop/IPFS_PATH')
.replace('app.asar', 'app.asar.unpacked'),
path
)
4 changes: 2 additions & 2 deletions src/ipfs-on-path/scripts/bin-win/ipfs.cmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@echo off

if exist "%~dp0\..\IPFS_PATH" (
SET /P IPFS_PATH=<"%~dp0\..\IPFS_PATH"
if exist "%USERPROFILE%\.ipfs-desktop\IPFS_PATH" (
SET /P IPFS_PATH=<"%USERPROFILE%\.ipfs-desktop\IPFS_PATH"
)

"%~dp0\..\..\..\..\node_modules\go-ipfs-dep\go-ipfs\ipfs.exe" %*
4 changes: 2 additions & 2 deletions src/ipfs-on-path/scripts/ipfs.sh
Original file line number Diff line number Diff line change
@@ -2,8 +2,8 @@

dir="$(dirname "$(test -L "$0" && readlink "$0" || echo "$0")")"

if [ -f "$dir/IPFS_PATH" ]; then
export IPFS_PATH="$(cat "$dir/IPFS_PATH")"
if [ -f ~/.ipfs-desktop/IPFS_PATH ]; then
export IPFS_PATH="$(cat ~/.ipfs-desktop/IPFS_PATH)"
fi

# Get the full path of the app directory (resolving the symlink if needed)

0 comments on commit 0d0f71a

Please sign in to comment.