[PATCH] PropertiesFile with applicationName containing a dot


Here is a patch that solves an issue in PropertiesFile when the applicationName contains a dot. The part after the dot was replaced by the extension. The issue came in that withFileExtension() replaces an existing extension whereas in this case the extension has just to be appended.


Don’t you have full control over the applicationsName variable? Can’t you just give it an applicationsName without a suffix? Your change is kind of a breaking change. I could imagine that many people want to have the properties file name to be “MyCoolApp.settings” when the app name is “MyCoolApp.exe”.

Using .exe in the appname and wanting it to be removed in the settings is quite weird, but I agree that this is a use case of the code, so any change should probably need breaking old code to force the devs to manage compatibility, for example by altering the name of a member of the PropertiesFile::Options class, or creating a new member appName and deprecating the applicationName so that a warning message can be read by the devs.

The origin of this patch is the following: I’d like to have my settings file on mac that begins with a dot, so that it can’t be visible. This could probably be managed with a flag and adding the dot in the file name building, however the patch I propose fixes an unexpected behaviour. If this behaviour needs to be maintained, I suggest that this is written in the documentation.

OK I’ve added a way to do this to the develop branch. See the comment here. Does this work for you?

OK, except this small typo in the documentation: