spieglt / FlyingCarpet

Cross-platform AirDrop. File transfer between Android, iOS, Linux, macOS, and Windows over ad hoc WiFi. No network infrastructure required, just two devices with WiFi chips in close range.
GNU General Public License v3.0
3.6k stars 145 forks source link

macOS app has inaccurate version information #23

Closed vitorgalvao closed 3 years ago

vitorgalvao commented 3 years ago

To accurately display version information, macOS apps need to have the CFBundleVersion and CFBundleShortVersionString tags in Info.plist.

In Flying Carpet’s case, the latter is set to a fixed 1.0.0 while the former is not present.

If they’re not set during the build process, they can be added after it’s done by directly editing the Info.plist:

# Change these values
app_path='/PATH/TO/APP/HERE'
app_version='VERSION NUMBER HERE'

# Keep these as they are
/usr/libexec/PlistBuddy -c "Add :CFBundleVersion string ${app_version}" "${app_path}/Contents/Info.plist" # Adds the missing value
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString string ${app_version}" "${app_path}/Contents/Info.plist" # Modifies the existing value

That would use the same version number for both fields. Technically they should be different, but that’s a secondary concern. An accurate version number is important for macOS to know which app to open in ambiguous situations; for users who expect the information available via the Finder; and for interoperability with other apps.

spieglt commented 3 years ago

Ok thanks, probably be next week sometime but I'll fix.

spieglt commented 3 years ago

@vitorgalvao I updated CFBundleShortVersionString and added CFBundleVersion and updated the Mac 4.1 binary on the releases page. What's the easiest way to check that value in macOS?

vitorgalvao commented 3 years ago

What's the easiest way to check that value in macOS?

# Change this value
app_path='/PATH/TO/APP/HERE'

# Keep these as they are
for version in {CFBundleVersion,CFBundleShortVersionString}; do
  echo -n "${version}: "
  /usr/libexec/PlistBuddy -c "Print :${version}" "${app_path}/Contents/Info.plist"
done

That would return:

CFBundleVersion: 4.1
CFBundleShortVersionString: 4.1