Confirmation before changing file to new version

Would it be possible to add a check when opening a .glyphs file whether its appVersion matches the version of the app opening it, and ask the user for confirmation if they don’t match?

When working on a project with multiple people, you usually want to make sure that everybody involved uses the same version of Glyphs, to avoid errors that can occur when files move between versions. But then some people work on multiple projects, so they need to have multiple Glyphs versions installed, and others may be running cutting edge versions for testing and stable versions for production work. It’s then too easy to inadvertently open a file in the wrong app version and save it in an unintended newer or older version.

1 Like

+1 for this. Apparently a version string is already stored in the glyphs file, but I assume that one changes each time the file gets saved from another Glyphs version. So sth. like a Custom Parameter would be lovely, where you can declare a certain Glyphs build along with the file.

I can easily make a plugin for that, but we’d have to rely on that it really really works. It’s too dangerous to assume all is okay when it doesn’t notify. Because it will also not notify when it’s broken for any reason. And every contributor would need to make sure to have the plugin installed. Hence I think that a Glyphs built-in notifier would be genuinely the best.

2 Likes

Hi @Norbert, looks like we can communicate better here than via e-mail :smiley:
@GeorgSeifert we encountered a huge problem where the Thai part was moved behind the Myanmar between two builds of Glyphs. This messed up the whole engineering. So far we can get away with sticking to one Glyphs version, But what is the future of these files supposed to be? Will we forever have to open these files with an by then super old Glyphs version, just to keep the setup as we wanted? Was this a mistake in the Glyphs build? Was it on purpose? If so, how can we translate our files to work with new Glyphs versions? What do you think?

1 Like

I’ve had really bad problems when my files have been opened by others with different versions of Glyphs. One time I had to spend days figuring out what had happened to auto-aligned components and shift them back to where I’d left them after the client resaved the file on an older version. Stability is really important and the update notes ‘improved x’ or ‘fixed y’ don’t always specify what exact things have changed, or how to manage them.

Something like this?

2 Likes

That would be awesome! :heart_exclamation:

Would it be coming all the time, or would it be better to add a note to certain font files, where one decides it’s important to know? Maybe it could be too annoying in an ordinary designer workflow? Not sure.

It is indeed a bit annoying (with my test files) but should show only once per file (if you save it).

How about a Pref to turn it off?

Lets see how annoying it is in real live.

Yes, this warning should be sufficient. And I’d guess most people don’t have that many files and upgrade that often that it would be annoying. Let’s try and see if there are complaints before making things more complicated.

Editorial: Maybe “This file was previously saved with a different version of Glyphs, build 1070. You’re now using build 1079.”?

That is a wrong guess, and I’m sure I’m not alone in staying updated with the latest Cutting Edge version. That being said, it can’t be any worse than autoplay advertising in browsers.

So what we tried to do in our latest workflow was to all agree on one particular build to use … What if we would rather add a CustomParamter into the font info, specifying the desired build for that file. And the notification would only react to that CP if it’s given? Something like ”RecommendedGlyphsBuild« or just ”UseBuild" or anything alike.

In most of my workflows the build doesn’t matter, but in collaboration and with sensitive engineering it does.

2 Likes

Suggestion: Include the filename in the notification window.

When someone previously had multiple files open, starting with a new version will show multiple notifications.

I fixed that.

If you’ll permit me to hijack this thread, I have a related request/idea… Would it be possible to automatically archive old versions of Glyphs when updating? I envision having a folder that could sit next to the App called something like “Glyphs - Previous Versions”. After each update the old Glyphs version could get renamed to include the build number and stuck in there, instead of being trashed. I’d rather just have them kept automatically and worry about deleting unnecessary versions later.

2 Likes

I will not add that coping of the versions as a default feature. But you can do that yourself. There is a callback that helps build a plugin that can do that:

# encoding: utf-8

from GlyphsApp.plugins import *
import os
from Foundation import NSFileManager

class Backuper(GeneralPlugin):
	def start(self):
		Glyphs.addCallback(self.doBackup, DOCUMENTOPENED)
	
	def doBackup(self, sender):
		document = sender.object()
		importedVersion = document.valueForKey_("importedVersion")
		if importedVersion != None and int(Glyphs.buildNumber) > int(importedVersion):
			documentPath = document.fileURL().path()
			fileName = os.path.basename(documentPath)
			bachupFolder = os.path.join(os.path.dirname(documentPath), "Backup")
			bachupPath = os.path.join(bachupFolder, importedVersion + "_" + fileName)
			
			fileManager = NSFileManager.defaultManager()
			if fileManager.fileExistsAtPath_isDirectory_(bachupFolder, None) == (False, False):
				if not fileManager.createDirectoryAtPath_withIntermediateDirectories_attributes_error_(bachupFolder, True, None, None):
					print "Could not make backup folder"
			
			if fileManager.isReadableFileAtPath_(documentPath):
				NSFileManager.defaultManager().copyItemAtPath_toPath_error_(documentPath, bachupPath, None)
	
	def __file__(self):
		"""Please leave this method unchanged"""
		return __file__
1 Like

Thanks Georg! I think this could be a helpful tool.

One issue, I get this error when trying to run the script…

Traceback (most recent call last):
File "<string>", line 7, in <module>
objc.error: Backuper is overriding existing Objective-C class

This is not supposed to be run as a script but that is the implementation of a plugin. I can put it in the Plugin Manager.

1 Like

I see it there now. Thanks a lot Georg!

I find the warning window annoying. Could you make the option available in preferences, preferably from three of these: Warning window just like now, notification at the top right, or no warning?