aboutsummaryrefslogtreecommitdiff
path: root/build/blog/2015-03-22-back-up-os-x-app-icons.html
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2017-04-28 19:05:18 +0200
committerneodarz <neodarz@neodarz.net>2017-04-28 19:05:18 +0200
commitcdabe7a75ea14f14ca8d4cd3bf9ac36cb1817531 (patch)
treea3a9557d77f376394bb8e49fc48dcdef556ecb38 /build/blog/2015-03-22-back-up-os-x-app-icons.html
parentd08bc695f396f8e2d7fc96de7efe61818c7c9a15 (diff)
downloadmy_new_personal_website-cdabe7a75ea14f14ca8d4cd3bf9ac36cb1817531.tar.xz
my_new_personal_website-cdabe7a75ea14f14ca8d4cd3bf9ac36cb1817531.zip
Delete some usless file
Diffstat (limited to '')
-rw-r--r--build/blog/2015-03-22-back-up-os-x-app-icons.html74
1 files changed, 0 insertions, 74 deletions
diff --git a/build/blog/2015-03-22-back-up-os-x-app-icons.html b/build/blog/2015-03-22-back-up-os-x-app-icons.html
deleted file mode 100644
index e243c42f..00000000
--- a/build/blog/2015-03-22-back-up-os-x-app-icons.html
+++ /dev/null
@@ -1,74 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8"/>
-<meta content="pandoc" name="generator"/>
-<meta content="Zhiming Wang" name="author"/>
-<meta content="2015-03-22T16:58:50-0700" name="date"/>
-<title>Back up OS X app icons</title>
-<link href="/img/apple-touch-icon-152.png" rel="apple-touch-icon-precomposed"/>
-<meta content="#FFFFFF" name="msapplication-TileColor"/>
-<meta content="/img/favicon-144.png" name="msapplication-TileImage"/>
-<meta content="width=device-width, initial-scale=1" name="viewport"/>
-<link href="/css/normalize.min.css" media="all" rel="stylesheet" type="text/css"/>
-<link href="/css/theme.css" media="all" rel="stylesheet" type="text/css"/>
-<link href="/css/highlight.css" media="all" rel="stylesheet" type="text/css"/>
-</head>
-<body>
-<div id="archival-notice">This blog has been archived.<br/>Visit my home page at <a href="https://zhimingwang.org">zhimingwang.org</a>.</div>
-<nav class="nav">
-<a class="nav-icon" href="/" title="Home"><!--blog icon--></a>
-<a class="nav-title" href="/"><!--blog title--></a>
-<a class="nav-author" href="https://github.com/zmwangx" target="_blank"><!--blog author--></a>
-</nav>
-<article class="content">
-<header class="article-header">
-<h1 class="article-title">Back up OS X app icons</h1>
-<div class="article-metadata">
-<time class="article-timestamp" datetime="2015-03-22T16:58:50-0700">March 22, 2015</time>
-</div>
-</header>
-<p>OS X application icons are valuable assets, and it's interesting to see how they evolve over time. This is especially the case when we upgraded to OS X 10.10 Yosemite, when Apple and many design-aware third party developers overhauled (mainly flattened) their icons.</p>
-<p>However, we lose all the old icons when we do a major OS upgrade. Technically they still live in Time Machine backups, but those are a pain to pull out. Therefore, I wrote a script just now to back up app icons of all applications living in <code>/Applications</code> (including those symlinked to <code>/Applications</code>, e.g., apps installed through <code>brew cask</code>) and its level-one subdirectories, and <code>/System/Library/CoreServices</code> (for <code>Finder.app</code> and such). Here's the script:</p>
-<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="co">#!/usr/bin/env bash</span>
-<span class="kw">function</span><span class="fu"> app_version</span>
-<span class="kw">{</span>
- <span class="co"># $1 is the path to the app</span>
- <span class="ex">/usr/libexec/PlistBuddy</span> -c <span class="st">"print CFBundleShortVersionString"</span> <span class="st">"</span><span class="va">$1</span><span class="st">"</span>/Contents/Info.plist <span class="op">2&gt;</span>/dev/null <span class="kw">||</span> <span class="fu">date</span> +%Y%m%d
-<span class="kw">}</span>
-
-<span class="kw">function</span><span class="fu"> app_icon_path</span>
-<span class="kw">{</span>
- <span class="co"># $1 is the path to the app</span>
- <span class="va">filename=$(</span><span class="ex">/usr/libexec/PlistBuddy</span> -c <span class="st">"print CFBundleIconFile"</span> <span class="st">"</span><span class="va">$1</span><span class="st">"</span>/Contents/Info.plist <span class="op">2&gt;</span>/dev/null<span class="va">)</span>
- [[ <span class="ex">-n</span> <span class="va">${filename}</span> ]] <span class="kw">||</span> <span class="bu">return</span>
- <span class="va">filename=$(</span><span class="fu">basename</span> <span class="st">"</span><span class="va">${filename}</span><span class="st">"</span> .icns<span class="va">)</span>
- <span class="bu">echo</span> <span class="st">"</span><span class="va">$1</span><span class="st">/Contents/Resources/</span><span class="va">${filename}</span><span class="st">.icns"</span>
-<span class="kw">}</span>
-
-<span class="kw">function</span><span class="fu"> process_app</span>
-<span class="kw">{</span>
- <span class="co"># $1 is the path to the app</span>
- <span class="va">name=$(</span><span class="fu">basename</span> <span class="st">"</span><span class="va">$1</span><span class="st">"</span> .app <span class="kw">|</span> <span class="fu">tr</span> -d <span class="st">' '</span><span class="va">)</span>
- <span class="va">path=$(</span><span class="ex">realpath</span> -e <span class="st">"</span><span class="va">$1</span><span class="st">"</span><span class="va">)</span> <span class="kw">||</span> <span class="kw">{</span> <span class="bu">echo</span> <span class="st">"</span><span class="va">${RED}</span><span class="st">error: broken link '</span><span class="va">${path}</span><span class="st">'</span><span class="va">${RESET}</span><span class="st">"</span> <span class="op">&gt;&amp;2</span><span class="kw">;</span> <span class="bu">return</span> 1<span class="kw">;</span> <span class="kw">}</span>
- <span class="va">version=$(</span><span class="ex">app_version</span> <span class="st">"</span><span class="va">${path}</span><span class="st">"</span><span class="va">)</span>
- <span class="va">icon_path=$(</span><span class="ex">app_icon_path</span> <span class="st">"</span><span class="va">${path}</span><span class="st">"</span><span class="va">)</span>
- [[ <span class="ex">-n</span> <span class="va">${icon_path}</span> ]] <span class="kw">||</span> <span class="kw">{</span> <span class="bu">echo</span> <span class="st">"</span><span class="va">${YELLOW}</span><span class="st">warning: '</span><span class="va">$1</span><span class="st">' has no app icon</span><span class="va">${RESET}</span><span class="st">"</span><span class="kw">;</span> <span class="bu">return</span> 1<span class="kw">;</span> <span class="kw">}</span>
- [[ <span class="ex">-f</span> <span class="va">${icon_path}</span> ]] <span class="kw">||</span> <span class="kw">{</span> <span class="bu">echo</span> <span class="st">"</span><span class="va">${RED}</span><span class="st">error: '</span><span class="va">${icon_path}</span><span class="st">' does not exist</span><span class="va">${RESET}</span><span class="st">"</span> <span class="op">&gt;&amp;2</span><span class="kw">;</span> <span class="bu">return</span> 1<span class="kw">;</span> <span class="kw">}</span>
- <span class="fu">cp</span> <span class="st">"</span><span class="va">${icon_path}</span><span class="st">"</span> <span class="st">"</span><span class="va">${name}</span><span class="st">-</span><span class="va">${version}</span><span class="st">.icns"</span>
- <span class="bu">echo</span> <span class="st">"</span><span class="va">${name}</span><span class="st">-</span><span class="va">${version}</span><span class="st">.icns"</span>
-<span class="kw">}</span>
-
-<span class="fu">find</span> /Applications -maxdepth 2 -name <span class="st">'*.app'</span> <span class="kw">|</span> <span class="kw">while</span> <span class="bu">read</span> <span class="va">app</span>; <span class="kw">do</span> <span class="ex">process_app</span> <span class="st">"</span><span class="va">${app}</span><span class="st">"</span><span class="kw">;</span> <span class="kw">done</span>
-<span class="fu">find</span> /System/Library/CoreServices -maxdepth 1 -name <span class="st">'*.app'</span> <span class="kw">|</span> <span class="kw">while</span> <span class="bu">read</span> <span class="va">app</span>; <span class="kw">do</span> <span class="ex">process_app</span> <span class="st">"</span><span class="va">${app}</span><span class="st">"</span><span class="kw">;</span> <span class="kw">done</span></code></pre></div>
-<p>The script is also available as a <a href="https://gist.github.com/zmwangx/fad97e085045a21ebc1d">gist</a>.</p>
-</article>
-<hr class="content-separator"/>
-<footer class="footer">
-<span class="rfooter">
-<a class="rss-icon" href="/rss.xml" target="_blank" title="RSS feed"><!--RSS feed icon--></a><a class="atom-icon" href="/atom.xml" target="_blank" title="Atom feed"><!--Atom feed icon--></a><a class="cc-icon" href="https://creativecommons.org/licenses/by/4.0/" target="_blank" title="Released under the Creative Commons Attribution 4.0 International license."><!--CC icon--></a>
-<a href="https://github.com/zmwangx" target="_blank">Zhiming Wang</a>
-</span>
-</footer>
-</body>
-</html>