Json file linking issues with resources folder


(Stephen G) #1

Hi I am having a problem working with json files within Hype. Here’s what I am trying to do and what is happening:

  • I have a Hype project that has 150 json files in the resources folder.
  • The json files are linked to hype from a folder in an external HD
  • When I open the folder from the external HD in my text editor and make a change to any of the json files Hype recognises the change and updates the file in the resource folder -perfect!
  • This is exactly what I need it to do however I am working from two computers one in a home office and one in my usual office so the path to the files is different on one machine and I need to relink the json files every time I open the hype project on my home computer.

Heres the issue:

  • When I open the hype project on my home computer the directory where hype is looking for the json files has changed slightly so all files are unlinked.
  • To solve this I open the hype project and delete all jsons then reimport them from the hard-drive again thus resolving the link in Hype.
  • This approach has worked fine up until the number of files has increased and now hype doesn’t recognise that i have updated the files.
  • I have tried to reimport 30 files at a time and this works some of the time but is not reliable.

Question: Is there any way to update the path to these 150 json files manually within Hype instead of deleting and trying to reimport the files each time.

My feelings are that this could be done using the data.plist file but I don’t know anything about it so am reluctant to make changes.

Any help would be much appreciated.
Stephen.


(Mark Hunte) #2

I suspect that will not work. You can change the paths but then you will probably break the projects bookmarking of the files. The bookmark is what keeps track of the changes to the files and what Hype likely partly uses to prompt you of an update to the files ( no expert on this so add salt)


(Stephen G) #3

Thanks for the reply Mark


#4

Can you share your file with us as a bug report (with all your jasons)? It may be that the bookmark link is strained for that many files and gives up, but @jonathan is more of an expert on this topic. Having your file will help us see what’s failing. Thanks for pushing it to the limit!


(Hans-Gerd Claßen) #5

store and load the jsons on/from a webserver …


(Jonathan Deutsch) #6

Links are lost when using Hype on another machine, this is a sad limitation of the Mac App Sandboxing technology required by Apple.

As long as the files are named the same, you should just be able to drag in all the files en masse into the Resource Library, and it will ask if you want to replace the ones that are named the same.

I really don’t recommend editing the data.plist! :slight_smile:


(Stephen G) #7

Thanks jonathan. The only method that works is to

create a new local folder with a different name than folder on HD
copy and paste all 150 jsons from original (linked folder) into new folder
delete all jsons from within hype using - button
import back into hype using + button from the new folder
save the hype project
continue editing new folder from text editor
changes will apply within Hype.

Just dragging this amount of jsons en masse causes the files to unlink for some reason but have found that the method above works all be it time consuming.

Thanks for the reply,
Stephen.


(Stephen G) #8

this might work…but wanted the ease of working locally and offline at times. Will consider testing, thanks


(Stephen G) #9

Thanks @Daniel whats the best way to share this with you privately? also that video :joy: Stephen.


(Mark Hunte) #10

Can you clarify,

From first reading I thought the issue was the paths where different on on Mac to the other,

i.e

/Users/homeuserName/Documents/jsonfolder/


/Users/workuserName/Documents/jsonfolder/

And you are not only copying the json files but also the hype file?.

If this is the case apps like dropbox I would think use local paths. Their local folders paths will be diffrerent if the original user folder name is different from the Work one. So not sure how that may resolve…?


DId you try @jonathan’s suggestion. if so what happened?


(Stephen G) #11

Your correct Mark the issue is a path issue as you described.

Jonathans solution wont work for a large number of files replaced at once and only works some of the time if you drag and replace small batches at a time.

I have created a work around that will solve the problem and let me work on both machines…see prev post.

The best option would be to have both home and work macs named the same so when the jsons are saved to an external HD and that HD is moved from computer to computer Hype knows no different (once you use the same USB port on both macs) this will be my fix going forward.


(Jonathan Deutsch) #12

Can you elaborate on what you tried and how you discovered it did not work? (Was it a replacement issue, or links were just not working)? I’m not sure why a small vs. large number would have an impact. I took a look at the code and it does appear the drag to replace will copy it over and make a new link.

I would be surprised if this works given how Apple’s security technologies probably lock the link down to a specific machine.


(Stephen G) #13

To be honest Jonathan im not sure were the problem lies but had been getting buggy UI events too so perhaps I was asking too much of the programme.

In any event I have simply copied all files to a new folder (locally) with a different name then deleted all of the jsons that were linked to the HD location through Hype then imported them again from new the local folder.

Moral of the story: Don’t use a HD to store and use a large number of dynamic json files across multiple computers, best to work locally or from a webserver perhaps as h_classen suggested above.

Appreciate the reply hope this clarifies the post.

Here is the offending Hype project (6 question sample WIP) >>

Regards,
Stephen.


(Jonathan Deutsch) #14

Thanks for the additional details. Very cool, and complex, document!

fwiw, the Hype 4 beta has an “edit in external editor” feature that allows editing items within the resource library directly without worrying about relinking. I think that would probably be a good workflow in this situation. (feel free to join the beta!)


(Stephen G) #15

Thanks @jonathan that lesson (along with others) will be in 100+ Irish schools before the end of the year to supplement children’s Maths skills! We are amazed with the power of Hype in constantly meeting our development requirements…with alot of help from the forum! The ‘edit in external editor’ feature sounds like a very useful addition. I will gladly join the beta programme as I am looking forward to see whats in store for hype 4.0 and how we can continue to develop our interactive lessons with Hype into the future!!


(Jonathan Deutsch) #16

Whoa, that’s awesome to hear about! Please do circle back after it has been so widely deployed - I’d love to hear how it went and any other thoughts you have.


(Stephen G) #17

No problem @jonathan will do!!