Skip to content

Commit 660c670

Browse files
committed
Corrects issue with backup/transfer of Illustrator preferences
1 parent fdeeb0d commit 660c670

6 files changed

Lines changed: 45 additions & 9 deletions

File tree

bin/console

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ $command[] = new Command\AdobeInfoCommand();
1616
$command[] = new Command\AdobeBackupCommand();
1717
$command[] = new Command\AdobeTransferCommand();
1818
$command[] = new Command\MenuAddCommand();
19-
$app = new Application('MacPrefer', 'v1.3.3');
19+
$app = new Application('MacPrefer', 'v1.3.4');
2020
$app->addCommands($command);
2121
$app->run();

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"email": "aaron@jonesicoding.com"
1515
}
1616
],
17-
"version": "1.3.3",
17+
"version": "1.3.4",
1818
"require": {
1919
"ext-json": "*",
2020
"ext-posix": "*",

dist/prefer.phar

16 KB
Binary file not shown.

resources/config/cc.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
"illustrator": {
33
"sap": "ILST",
44
"names": [ "Illustrator", "Illustrator CC" ],
5-
"preferences": ["Library/Preferences/Adobe Illustrator {baseVersion}"],
5+
"preferences": [
6+
"Library/Preferences/Adobe/Adobe Illustrator/{version}",
7+
"Library/Preferences/Adobe Illustrator {majorVersion} Settings"
8+
],
69
"path": "Adobe {name} {year}/Adobe Illustrator.app",
710
"baseVersions": {
811
"21.0.0": "2017",
@@ -31,7 +34,8 @@
3134
"path": "Adobe {name} {year}/Adobe {name} {year}.app",
3235
"preferences": [
3336
"Library/Preferences/Adobe {name} {year} Settings",
34-
"Library/Preferences/Adobe {name} {year} Paths"
37+
"Library/Preferences/Adobe {name} {year} Paths",
38+
"Library/Preferences/Adobe/Photoshop/{baseVersion}"
3539
],
3640
"baseVersions": {
3741
"18.0": "2017",

src/Command/AdobeTransferCommand.php

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ public function execute(InputInterface $input, OutputInterface $output)
139139

140140
// Version Replacement
141141
$this->io()->msg('Verifying Application Versions', 50);
142-
$srcVer = $src->getBaseVersion();
143-
$dstVer = $dst->getBaseVersion();
142+
$srcVer = $src->getVersion();
143+
$dstVer = $dst->getVersion();
144144
if (empty($srcVer) || empty($dstVer))
145145
{
146146
$this->io()->errorln('[ERROR]');
@@ -154,6 +154,22 @@ public function execute(InputInterface $input, OutputInterface $output)
154154
$this->io()->successln('[DONE]');
155155
}
156156

157+
$this->io()->msg('Verifying Application Base Versions', 50);
158+
$srcBaseVer = $src->getBaseVersion();
159+
$dstBaseVer = $dst->getBaseVersion();
160+
if (empty($srcBaseVer) || empty($dstBaseVer))
161+
{
162+
$this->io()->errorln('[ERROR]');
163+
164+
$this->io()->errorblk(sprintf('Could not verify versions for %s', $src->getName(false)));
165+
166+
return self::EXIT_ERROR;
167+
}
168+
else
169+
{
170+
$this->io()->successln('[DONE]');
171+
}
172+
157173
// Year Replacement
158174
$this->io()->msg('Verifying Application Year', 50);
159175
$srcYear = $src->getYear();
@@ -188,9 +204,12 @@ public function execute(InputInterface $input, OutputInterface $output)
188204
$this->io()->successln('[DONE]');
189205
}
190206

207+
$srcMajor = substr($srcVer, 0, strpos($srcVer, '.'));
208+
$dstMajor = substr($dstVer, 0, strpos($dstVer, '.'));
209+
191210
// Prep Search & Replace
192-
$search = [$srcVer, $srcName];
193-
$replace = [$dstVer, $dstName];
211+
$search = [$srcVer, $srcBaseVer, $srcName, $srcMajor];
212+
$replace = [$dstVer, $dstBaseVer, $dstName, $dstMajor];
194213
if (!empty($srcYear))
195214
{
196215
$search[] = $srcYear;
@@ -248,6 +267,12 @@ protected function copyPreferences($srcPrefs, $search, $replace)
248267
$srcPath = sprintf('%s/%s', $uDir, $srcPref);
249268
$dstPath = sprintf('%s/%s', $uDir, $dstPref);
250269

270+
if ($this->io()->getOutput()->isDebug())
271+
{
272+
$this->io()->write(' From...', null, 10)->writeln($srcPath);
273+
$this->io()->write(' To...', null, 10)->writeln($dstPath);
274+
}
275+
251276
if (file_exists($srcPath))
252277
{
253278
// Use Rsync for Directories

src/Objects/CreativeCloudApp.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,11 @@ public function getPreferences()
110110
{
111111
if (!empty($info['preferences']))
112112
{
113+
$find = ['{name}', '{year}', '{version}', '{baseVersion}', '{majorVersion}'];
114+
$replace = [$this->getName(false), $this->getYear(), $this->getVersion(), $this->getBaseVersion(), $this->getMajorVersion()];
113115
foreach ($info['preferences'] as $pr)
114116
{
115-
$prefs[] = str_replace(['{name}', '{year}', '{version}'], [$this->getName(false), $this->getYear(), $this->getBaseVersion()], $pr);
117+
$prefs[] = str_replace($find, $replace, $pr);
116118
}
117119
}
118120
}
@@ -168,6 +170,11 @@ public function getVersion()
168170
return $this->version;
169171
}
170172

173+
public function getMajorVersion()
174+
{
175+
return substr($this->getVersion(), 0, strpos($this->getVersion(), '.'));
176+
}
177+
171178
/**
172179
* Returns the name of this application, including the year if applicable.
173180
*

0 commit comments

Comments
 (0)