inky icon indicating copy to clipboard operation
inky copied to clipboard

Opens JSON rather than story file

Open ashleytwo opened this issue 8 years ago • 8 comments

Hello,

I had a file I have been previously using and it was fine. I made a minor amendment (added a knot and a word after it) and exported it to JSON as I wanted to check something on the JSON end, but as soon as I did it then displayed the JSON file in Inky. I've closed Inky and re-opened it and still no joy. It's still being recognised as an INK file in my file browser, but when I open it with Inky it's coming up as JSON.

It also says there are 8 errors but when I try and look at them they display like this:

inkerror

ashleytwo avatar Jan 20 '17 14:01 ashleytwo

Eek. Sounds like you saved over your ink file with your json file. That's... pretty bad.

cheers jon

On Fri, Jan 20, 2017 at 2:31 PM ashleytwo [email protected] wrote:

Hello,

I had a file I have been previously using and it was fine. I made a minor amendment (added a knot and a word after it) and exported it to JSON as I wanted to check something on the JSON end, but as soon as I did it then displayed the JSON file in Inky. I've closed Inky and re-opened it and still no joy. It's still being recognised as an INK file in my file browser, but when I open it with Inky it's coming up as JSON.

It also says there are 8 errors but when I try and look at them they display like this:

[image: inkerror] https://cloud.githubusercontent.com/assets/12561612/22152954/19056a10-df1d-11e6-9547-ec8ac48e8d9b.jpg

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/inkle/inky/issues/83, or mute the thread https://github.com/notifications/unsubscribe-auth/AA40o_dddns1dz8n5EGjBrliy7XHNFhUks5rUMVFgaJpZM4LpXQ2 .

joningold avatar Jan 20 '17 14:01 joningold

It is, thankfully, just a test file for me to figure out some stuff for Unity as opposed to an actual story I was planning on using.

However, when I click Export to JSON it only shows me JSON files so I can't see how I would have overwritten the INK file as just clicking save should just save it as JSON.

I just tested (with another file) and even going to Save as Web and selecting the INK file and overwriting that, it still doesn't save as JSON.

ashleytwo avatar Jan 20 '17 14:01 ashleytwo

If you click your ink file in the save folder window, it'll happily write over it; I think it doesn't prevent you saving the file as a non .json file. (At least, on my Mac that's what I see.) Worse still, the Mac folder bar only shows you the name of the file which is the same for json or your core ink file... so it's hard to tell if you've done it.

cheers jon

On Fri, Jan 20, 2017 at 2:52 PM ashleytwo [email protected] wrote:

It is, thankfully, just a test file for me to figure out some stuff for Unity as opposed to an actual story I was planning on using.

However, when I click Export to JSON it only shows me JSON files so I can't see how I would have overwritten the INK file as just clicking save should just save it as JSON.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/inkle/inky/issues/83#issuecomment-274090376, or mute the thread https://github.com/notifications/unsubscribe-auth/AA40o_60ibgUYSN6e4K6yjlrnbkCRimOks5rUMokgaJpZM4LpXQ2 .

joningold avatar Jan 20 '17 16:01 joningold

But I literally can't replicate that.

Export to JSON obviously just exports it as JSON and I can only save (and thus only overwrite) JSON files.

Export for Web automatically assigns the file type anyway, so if I select an INK file it saves it as INK (and it opens up fine again) and if I save it as JSON it saves it as JSON (and I can't open it in INK but it opens as JSON in another editor).

I can't see how I can have an INK file open and save over that INK file with the JSON contents instead (except of course copying and pasting the JSON into Inky then saving, but I didn't do that).

ashleytwo avatar Jan 20 '17 16:01 ashleytwo

I was just working on something else. Wrote a file and saved it as .ink, then went to Export to JSON and even though the dropdown is limited to .JSON files (and you can't even see the .ink file because of this filter) its trying to overwrite the .ink file if I don't change the file name.

error

ashleytwo avatar Jan 29 '17 11:01 ashleytwo

If anyone on Windows wants to try debugging this issue, the relevant code is here:

https://github.com/inkle/inky/blob/master/app/renderer/inkProject.js#L251

InkProject.prototype.export in inkProject.js, line 251. Not sure why it would be reverting the filename to save as the .ink version.

joethephish avatar Jan 30 '17 08:01 joethephish

I too have an ink file that now suddenly looks like JSON data when I open it in Inky. I have never used the export to json function directly, but as I was editing several ink files and I wanted to save them all, naturally I pressed ctrl+shift+s, the universal hotkey for Save All. But for some reason, in Inky, that is the hotkey for Export JSON. So yeah, maybe that's what happened for OP as well. It's really bad UX. Is there something in the format that would make it impossible to convert JSON back to ink format? I guess I'll have to go back in my git history and lose some work. But I'd make two suggestions to the devs: 1. Change that hotkey. Ctrl+shift+S is colloquially "Save All". Make export json either some combination with E or J. 2. Make the app refuse to export JSON to a .ink extension. If anyone ever REALLY wants to save JSON data in a .ink file, they can rename the file extension themselves. It's not a dev's responsibility to make their app idiot proof, but one can still have a minimum of safety measures built in, in my opinion. Especially when it comes to scenarios where users can potentially lose work.

Partybwal avatar Sep 10 '24 06:09 Partybwal

And also, even if I had deliberately tried to Export to json, why did it automatically select my ink file? Like op stated, it should be filtered to .json files when exporting, so it's still a mystery how we managed to select our .ink file when exporting?

Partybwal avatar Sep 10 '24 06:09 Partybwal