Keyman Developer: Copying a project folder with its *.kpj.user file is a recipe for confusion

~~
TLDR:
If you copy a Keyman Developer folder from another machine, either delete the *kpj.user file or make sure that the user doesn’t click on the “recent” link for the KMN. Clicking on the recent link in a project copied from another computer actually opens an unsaved blank KMN instead of the expected project keyboard and its supporting files.
~~

I copied a fully configured test keyboard project folder to 13 computers today. Each user opened the .prj project from the folder, and the “recent” presented us with an enticing link to french_model.kmn on the information tab. I instructed them to click on the link.

image

On all of their computers, it opened an unsaved blank KMN with none of my code in the layout tab, no onscreen keyboard, no icon, and no touch layout. I had to stop class to figure out what went wrong. This is actually the second time I’ve encountered this problem on someone else’s computer, but I failed to diagnose it the first time.

The recent list comes from the .kpj.user XML file which resides in the project folder and uses absolute links. If you copy a whole project folder, the kpj.user file comes with it and lists the recent files from the source machine. If you don’t carefully expand the description and read the path, you’d never know that the path is invalid. Clicking on a hyperlink to a non-existent file doesn’t warn the user that the file doesn’t exist or ask if you want to create it, instead, it opens a blank unsaved KMN file as if it was the target file, greatly confusing the user who expected to see the KMN and supporting files from the project that they copied. To make things worse, if the path is invalid (i.e. on a drive you don’t have), you can’t save the new file where it wants to.

The first time I saw this, the user thought the user had failed to copy all of the supporting files, and we made a mess of things creating a new touch layout and trying to copy the old one over it (never realizing that we were working in a different folder). Today, it took me a while to realize that the suggested “recent” hyperlink came from the source computer and contained an absolute path that only existed on the source machine (My username is not “Louis Pascal”, so that folder structure doesn’t exist):

image

Testing on a local machine, I realized that all I had to do was go to the keyboard tab, manually open the KMN file (File>Open), avoid that link, or delete the copied .kpj.user file to remove the broken recent hyperlink.

This is an unintended user trap. Please either verify out-of-date links, clearly warn the user if they click on a link to a non-existant file, or find a way to use relative links in the kpj.user file so that the whole folder can be moved between locations and going to the KMN inside the project “just works”.

We encountered this today on Keyman 16.107, but I believe we first encountered it in 15x.

2 Likes

Thanks for including specific steps. We’ll track this as issue bug(developer): Copying a project folder with its *.kpj.user file is a recipe for confusion · Issue #7808 · keymanapp/keyman · GitHub

1 Like

I’ve posted a potential fix to be merged into 16.0 beta.

Easiest solution is store your keyboard in a local git repository. When ever you need a zip snapshot use the git archive command. If the computers you are migrating files to also have got you can use git bundle then they can do git clone on the bundle.