Commit Graph

67 Commits

Author SHA1 Message Date
Allan Odgaard
1ef78b3af7 Rename symbols to what’s expected by the 10.14 SDK 2019-06-29 20:14:15 +02:00
Allan Odgaard
f6fa273912 Update coding style for where to place colon after dictionary keys
This follows the Swift style and also makes it possible to align dictionary values using TextMate’s Align Assignments command.
2018-10-07 09:54:45 +02:00
Ronald Wampler
dfecd02e62 Fix typo: 'therefor' → 'therefore' 2018-10-03 20:16:50 +02:00
Allan Odgaard
0e863b76ea Use title case for software update error dialog 2018-07-30 22:37:35 +02:00
Allan Odgaard
177321e3c4 Warn user when running on a read-only file system.
See https://mjtsai.com/blog/2016/06/16/gatekeeper-path-randomization/ for details.
2018-07-30 22:37:35 +02:00
Allan Odgaard
52fda481dc Change beta/nightly software update constants to prerelease/canary 2018-06-28 10:40:27 +02:00
Allan Odgaard
e70791ee89 Rename a bunch of constants to fix deprecation warnings (10.12) 2018-06-16 22:55:30 +02:00
Allan Odgaard
06bd8b2be0 Add a ‘didUpdateFrom’ argument when relaunching during software update 2017-10-08 20:17:43 +02:00
Allan Odgaard
a8b7906a4b Do not hardcode bundle identifier in Caches path 2017-10-08 20:12:14 +02:00
Allan Odgaard
6893bceae6 Accept application/json for version update information 2017-10-08 19:54:32 +02:00
Allan Odgaard
81d1f84a2c Change sw_update.cc → sw_update.mm 2017-10-08 09:13:03 +02:00
Allan Odgaard
e804a57e04 Change name of property setter: isChecking → checking 2017-10-02 20:53:05 +02:00
Allan Odgaard
8d56ad455a Use NSBundle API instead of oak::application_t 2017-10-02 20:53:05 +02:00
Allan Odgaard
5bc450f56f Move instance variables from implementation to interface block 2017-10-02 20:53:05 +02:00
Ronald Wampler
b8143a626c Avoid use of NSRunInformationalAlertPanel (10.9)
Although this is actually deprecated in 10.10, new APIs are available in 10.9 and it will make addressing deprecation warnings when upgrading to 10.10 easier.
2017-05-31 21:58:31 +02:00
mathbunnyru
440414f96c Use nullptr in all C++ files instead of NULL
This brings us a bit of extra type safety, for example where an integer is expected, nullptr should be disallowed by the compiler (unlike NULL).
2016-10-22 21:40:14 +07:00
mathbunnyru
d6db299a8f Changed from NULL to nullptr in variadic templates for portability 2016-10-19 00:59:11 +03:00
Allan Odgaard
7cc017f343 Harmonize all implementations of sharedInstance 2016-09-19 12:54:19 +02:00
Allan Odgaard
46fb745bbe Use perrorf when printing errors with dynamic strings
Also revise error messages to be more consistent.
2016-08-28 17:25:26 +02:00
Allan Odgaard
dbdfa3c6af Add identifying information to perror output 2016-08-21 12:09:30 +02:00
Allan Odgaard
fb7c2cef3f Use NSUserDefaults’s specialized «type»ForKey: 2016-06-20 11:43:40 +02:00
Allan Odgaard
ebf20acc20 Prefer CFBundleShortVersionString over CFBundleVersion 2014-11-10 09:01:05 +01:00
Allan Odgaard
2f1c4c05c4 Do not use ‘timeIntervalSinceNow’ with dates in the past
We previously negated the result but now we instead ask for [[NSDate date] timeIntervalSinceDate:startDate].
2014-08-21 16:07:23 +02:00
Allan Odgaard
603f06d2db Move version comparison out of s/w update framework 2014-04-25 16:55:31 +07:00
Allan Odgaard
1f0e3db472 Remove trailing zeroes from numeric literals
I mainly dislike the trailing zeroes because CGFloat used to be a float but 1.0 is a double (1.0f would be a float). So better to under-specify and let the compiler figure out the proper type.
2014-04-14 14:26:52 +07:00
Allan Odgaard
cf8f796053 Do not use va_start macro with variable reference
This is undefined according to the standard and is a warning with clang-503.0.38.
2014-03-13 20:51:15 +07:00
Allan Odgaard
1e11a30a53 Remove redundant storage keywords for @property
These were required prior to the new 64 bit run-time.
2014-03-05 16:39:54 +07:00
Allan Odgaard
c2397484b8 Use C++11 for loop
Majority of the edits done using the following ruby script:

    def update_loops(src)
      dst, cnt = '', 0

      block_indent, variable = nil, nil
      src.each_line do |line|
        if block_indent
          if line =~ /^#{block_indent}([{}\t])|^\t*$/
            block_indent = nil if $1 == '}'
            line = line.gsub(%r{ ([^a-z>]) \(\*#{variable}\) | \*#{variable}\b | \b#{variable}(->) }x) do
              $1.to_s + variable + ($2 == "->" ? "." : "")
            end
          else
            block_indent = nil
          end
        elsif line =~ /^(\t*)c?iterate\((\w+), (?!diacritics::make_range)(.*\))$/
          block_indent, variable = $1, $2
          line = "#$1for(auto const& #$2 : #$3\n"
          cnt += 1
        end
        dst << line
      end
      return dst, cnt
    end

    paths.each do |path|
      src = IO.read(path)

      cnt = 1
      while cnt != 0
        src, cnt = update_loops(src)
        STDERR << "#{path}: #{cnt}\n"
      end

      File.open(path, "w") { |io| io << src }
    end
2014-03-03 10:34:13 +07:00
Allan Odgaard
e4e80a946c Use std::make_shared 2013-09-03 12:27:20 +02:00
Allan Odgaard
ee10f79ed4 Fix non-retaining Objective-C property
The ‘lastVersionDownloaded’ property used ‘assign’ (since it used to be an integer) which meant TextMate would likely crash when the property was read (and had a non-nil value), which it would, when TextMate did a version check after already having downloaded an update (but not yet installed and relaunched).

Also drop the atomic requirement of the ‘archive’ property since we no longer access it from multiple threads.
2013-08-03 11:54:52 +02:00
Allan Odgaard
8d51e930e3 Ensure version_less(NULL_STR, «any») → true 2013-08-02 16:21:21 +02:00
Allan Odgaard
33a47898e1 Remove revision field from version_info_t 2013-07-02 18:43:46 +02:00
Allan Odgaard
9adac35f86 Use complex version string during software update checks
While it is simpler to compare a monotonically increasing integer (the revision), we always use the semantic version string in the user interface, meaning that this version string should change together with the revision, which effectively means we are maintaing two version numbers.

We previously embedded the revision in the version string (2.0-alpha.$revision) but when going from alpha → beta, it would be nice to reset the visible counter, so that first beta becomes 2.0-beta.1, furthermore, test versions could benefit from a more descriptive version string, e.g. “2.0-alpha.9439.2+debug” would be the second (semi-public) debug build after “2.0-alpha.9439”.
2013-07-02 18:43:46 +02:00
Allan Odgaard
6c2ed2053d Trim version string received from server 2013-07-02 18:43:46 +02:00
Allan Odgaard
dc1a53aa38 Add code for comparing complex version strings 2013-07-02 18:43:46 +02:00
Allan Odgaard
8017428011 If deleting old version fails then move it to trash
We also add a time suffix to the old version so that if we fail to remove it, the user will not get (another) error when retrying the update.

Presumably fixes #991.
2013-05-26 13:32:46 +08:00
Allan Odgaard
b489687403 Disable AuthorizationExecuteWithPrivileges deprecation warning
The “proper” replacement for this API is to use the ServiceManagement framework’s SMJobBless() to bless our helper tool. In two of the three use-cases our helper tool is however regular shell commands, so it seems redundant to wrap these shell tools as helper tools we can install as launchd jobs.
2013-05-06 14:51:31 +07:00
Allan Odgaard
04963caf01 Remove use of deprecated method 2013-04-09 15:39:38 +07:00
Allan Odgaard
b8c81b4acf Fix software updater to not skip checking
Initially ‘downloadWindow’ was a property that was nil until we showed the download window, but now that the download window is re-used for downloading newer versions (incase a newer version appear before user does the “Install & Relaunch”) the fetching the property will return the window (and create it if not already created).
2013-03-28 22:01:40 +01:00
Allan Odgaard
e1e0e5a8a5 Re-use download window if already visible
This is useful if a new update arrives after TextMate has downloaded the previous update but before the user relaunched TextMate.

Fixes #909.
2013-03-19 16:24:56 +01:00
Allan Odgaard
769831f629 Use Objective-C literals 2013-03-19 15:49:18 +01:00
Allan Odgaard
c65e0718e6 Show human readable version string
This is instead of only showing the revision, which lack semantic info such as ‘alpha’ and 2.0 versus 1.5.11.

We now also show the version after a successful download instead of just “Download Completed”.
2013-02-15 15:27:55 +01:00
Allan Odgaard
50a7c17dbd Use initializer list with path::join 2013-02-12 11:09:24 +01:00
Allan Odgaard
ad03811df0 Ensure session restore when relaunching
The user can manually disable session restore, which is undesired when relaunching due to a software update or installing a plug-in, so we now override the user’s choice for the new instance launched.
2013-02-11 14:21:22 +01:00
Allan Odgaard
d00b9b34aa Change how we update TextMate.app
We now keep the root folder and instead replace the inner Contents folder — hopefully this way LaunchServices won’t add the update as a new entry (causing duplicates to show up in the Open With menu).
2013-01-21 15:03:52 +01:00
Allan Odgaard
0208414672 Download s/w updates to cache folder
This should hopefully solve the issue with the (on some systems) fairly aggressive temp cleaner.

Also remove the archive incase the user cancels the update, now that we are extracting it to a less temporary location.
2013-01-21 15:03:52 +01:00
Allan Odgaard
47fa0f040c Use Objective-C literals for YES/NO 2013-01-02 01:46:48 +01:00
Allan Odgaard
09abc8eede Fix software update logic
It would previously not ask to update (but go directly to download) when doing a manual update check.
2012-12-24 14:09:41 +01:00
Allan Odgaard
601cf28366 Use the low priority dispatch queue for update checks
Presently mainly a semantic change, as the dispatch queues are mostly empty, but as we adopt GCD for more things, it’ll be more important to put background tasks in a queue with lower priority than the one handling user requested tasks.
2012-12-20 14:02:39 +01:00
Allan Odgaard
c7780d1392 Add placeholder text for “time remaining” 2012-12-20 14:02:39 +01:00