Skip to content

[WIP] Altered path mentioned in defaultIconUrl #589

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

Closed
wants to merge 1 commit into from
Closed

[WIP] Altered path mentioned in defaultIconUrl #589

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Oct 27, 2018

The fallback image path didn't lead back to the fallback image most likely due to the change in the folder structure. Using __dirname and path.resolve(), we can now get a universal path to the given image.

Issue in focus: #533

Previous PR made: #575 [Closed due to my inability to test on Windows, apologies for that]


You have tested this PR on:

  • Windows
  • Linux/Ubuntu
  • macOS

Copy link
Member

@priyank-p priyank-p left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have one suggestion otherwise looks good to me. Thanks @Flowkrad for fixing this!

@@ -20,7 +20,7 @@ const logger = new Logger({

let instance = null;

const defaultIconUrl = '../renderer/img/icon.png';
const defaultIconUrl = path.resolve(__dirname, './../../img/icon.png');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd remove the ./ here since it's redundant and looks clear without the ./.

Suggested change
const defaultIconUrl = path.resolve(__dirname, './../../img/icon.png');
const defaultIconUrl = path.resolve(__dirname, '../../img/icon.png');

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for pointing that out (^_^)
Implemented the same in commit 46315ec

The icon previously was linked to the the path
'../renderer/img/icon.png' which made it only possible for files having
their working dirctory in the same directory as that of 'renderer' to
access the file via the fs. Ideally one would like the path to be set
such that the fallback image can be accessed effectively from any part
of the repository. Using '__dirname' and 'path.resolve()', we get a
universal path to the default icon so the fall back goes as intended.
@akashnimare
Copy link
Member

@priyank-p I think this won't work since you can't access the file as it's packed in app.asar.

image

@ghost
Copy link
Author

ghost commented Oct 28, 2018

I found this issue - Unable to access a file inside asar pacakge on Electron's Github page and this (comment) hints how it was solved.
Can an implementaation like that solve the issue?
@akashnimare

@ghost ghost changed the title Altered path mentioned in defaultIconUrl [WIP] Altered path mentioned in defaultIconUrl Nov 7, 2018
@akashnimare
Copy link
Member

@Flowkrad yeah, this might work. Can you try it out?
(sorry for the slow reply was sick)

@ghost
Copy link
Author

ghost commented Dec 11, 2018 via email

@Swapnilr1
Copy link
Collaborator

Swapnilr1 commented Jan 20, 2019

@akashnimare Since this issue was unresolved, I had made PR (https://github.com/zulip/zulip-electron/pull/627) to fix the issue. Please review it. According to me, this PR (#589) won't be able to resolve the issue.

@zulipbot
Copy link
Member

Heads up @Flowkrad, we just merged some commits that conflict with the changes your made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the upstream/master branch and resolve your pull request's merge conflicts accordingly.

@andersk andersk closed this Jan 22, 2021
@andersk andersk deleted the branch zulip:master January 22, 2021 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants