-
Notifications
You must be signed in to change notification settings - Fork 579
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
Fix default path of chain:export command #1035
Conversation
Checked this out a bit, I'm still seeing the issue. Testing on a mac,
Thinking about this a bit more, this might be difficult to get right with the way it's currently coded, because we use a slightly different file structure in Docker, brew, built from source, etc. |
@mat-if Interesting... Thank you for information. I will check. |
I had an idea last night. The easiest way to fix this is probably to store the json in the datadir. We would probably need to change the default path on the ironfish-graph-explorer as well to look in the datadir, as well, and give the file a more specific name, like 'chain-export.json' or something. |
Yeah... probably it is the best way. Let's ask team members in discord next monday. |
default: (): Promise<string> => { | ||
Assert.isNotUndefined(process.env.PWD) | ||
|
||
return Promise.resolve(`${process.env.PWD}/../ironfish-graph-explorer/src/data.json`) |
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.
This PR still uses incorrect relative paths. How about we just set the default path to the data directory in a folder called exports? I would recommend maybe just removing this default entirely, then below use the data dir from this.sdk.config.dataDir
where the data dir is stored if no path is specified.
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.
It's done by second way: default value of flag set to empty string and we will resolve path using this.sdk.config.dataDir
in that case.
@@ -18,7 +18,7 @@ export default class Export extends IronfishCommand { | |||
char: 'p', | |||
parse: (input: string): Promise<string> => Promise.resolve(input.trim()), | |||
required: false, | |||
default: '../ironfish-graph-explorer/src/data.json', | |||
default: '', |
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.
We can just delete this now
default: '', |
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.
Done.
Also, I added path accessibility verification.
7008c0f
to
69feb5c
Compare
69feb5c
to
256601b
Compare
I just removed the check access, and just had it recursively create the folder for better usability. It's now good to go. |
Summary
Fixes #997
Default path of
ironfish chain:export
command is constant and relative -../ironfish-graph-explorer/src/data.json
. It means command will always fail except when called from~/ironfish/*
subfolder (in situation when-p
flag is not set). It possible to fix such behavior usingprocess.env.PWD
.Testing Plan
There is no test for this command - it should be tested manually. Run
ironfish chain:export
w/o-p
flag from different places.Breaking Change
Is this a breaking change? If yes, add notes below on why this is breaking and
what additional work is required, if any.