Skip to content

Commit 0fd7d36

Browse files
committed
Added uninstaller
Minor cleanup in package files
1 parent a4fb853 commit 0fd7d36

23 files changed

+176
-92
lines changed

README.md

+3-7
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,7 @@ Please note that support for a macOS devices is <em><strong>possible</strong></e
129129
<br/>
130130

131131
# Installing
132-
To install, you will need to download and install ["Anastasiy's Extension Manager"](https://install.anastasiy.com/)
133-
Then download zxp package from [releases](https://github.com/Daniil-SV/SupercellSWF-Animate/releases)
134-
Open extension manager, click on "Install" button and then select zxp package you downloaded
135-
After a successful installation notification, you can close program and open Adobe Animate for use
136132

137-
## Alternative installing
138-
Go to folder `C:\Users\{USER NAME}\AppData\Roaming\Adobe\CEP\extensions` (If some folders do not exist, create) then create folder `com.scwmake.SupercellSWF`, open .zxp package as zip and unzip to created folder.
139133

140134
<br/>
141135

@@ -206,11 +200,13 @@ You can find a list of all available examples in ["examples"](/examples/README.m
206200

207201
# Issues
208202
If you find any problem with the export process, please report it in [Issues](https://github.com/sc-workshop/SupercellSWF-Animate/issues) or [join our Discord Server](https://discord.gg/uPnDsns6G6)
209-
Also, native part of plugin saves logs in "%temp%/com.scwmake.SupercellSWF_log.txt", please provide them along with a description for a faster solution to the problem.
203+
Also, native part of plugin saves logs in "%temp%/org.scWorkshop.SupercellSWF_export_log.txt", please provide them along with a description for a faster solution to the problem.
210204

211205
<br/>
212206

213207
# Changelog
208+
## v 1.2.1
209+
- Added experimental installer
214210
## v 1.2.0
215211
- Complete refactoring of code
216212
- Changed and improved design of Publisher Settings

bundle.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ export const config: ConfigInterface = {
4242
size: { width: 1, height: 1 }
4343
}
4444
},
45-
ImportCommand: {
46-
type: "command",
47-
path: "importer/import_sc.jsfl"
48-
}
45+
// ImportCommand: {
46+
// type: "command",
47+
// path: "importer/import_sc.jsfl"
48+
// }
4949
}
5050
}

importer/import_sc.jsfl

-1
This file was deleted.

installer/package.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "SupercellSWF-Animate-Installer",
3+
"private": true,
34
"version": "1.0.0",
45
"description": "Installer for SupercellSWF Animate Plugin",
56
"main": "runtime/install.jsfl",
@@ -10,9 +11,7 @@
1011
"author": "DaniilSV",
1112
"license": "MIT",
1213
"dependencies": {
13-
"types-for-adobe": "^7.2.1"
14-
},
15-
"devDependencies": {
16-
"patch-package": "^8.0.0"
14+
"types-for-adobe": "7.2.1",
15+
"patch-package": "8.0.0"
1716
}
1817
}

installer/runtime/core/locales/en_US.json

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
"TID_WINDOW_CLOSE": "Now close this window and restart Adobe Animate",
55
"TID_EXTENSION_INSTALL": "Extensions installing...",
66
"TID_COMMAND_INSTALL": "Commands installing...",
7+
"TID_CURRENT_VERSION": "Current version: ",
8+
"TID_UNINSTALL_PROPOSE": "Want to remove the current version of plugin?",
9+
"TID_UNINSTALL": "Uninstall",
10+
"TID_UNINSTALL_PROCESS": "Uninstalling...",
711

812
"TID_COMMAND_ImportCommand_NAME": "Import .sc"
913
}

installer/runtime/core/locales/ru_RU.json

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
"TID_WINDOW_CLOSE": "Закройте это окно и перезапустите Adobe Animate",
55
"TID_EXTENSION_INSTALL": "Установка расширения...",
66
"TID_COMMAND_INSTALL": "Установка команд...",
7+
"TID_CURRENT_VERSION": "Текущая версия: ",
8+
"TID_UNINSTALL_PROPOSE": "Хотите удалить текущую версию плагина?",
9+
"TID_UNINSTALL": "Удалить",
10+
"TID_UNINSTALL_PROCESS": "Удаление...",
711

812
"TID_COMMAND_ImportCommand_NAME": "Импортировать .sc"
913
}
Binary file not shown.
+52-16
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

22
class Localization {
3-
constructor(cwd: string) {
4-
let locale_path = cwd + "core/locales/" + this.lang + ".json";
3+
constructor() {
4+
let locale_path = window.SupercellSWF.cwd + "core/locales/" + this.lang + ".json";
55
if (!FLfile.exists(locale_path)) {
6-
locale_path = cwd + "core/locales/en_US.json";
6+
locale_path = window.SupercellSWF.cwd + "core/locales/en_US.json";
77
}
88

99
this.data = JSON.parse(FLfile.read(locale_path));
@@ -21,24 +21,60 @@ class Localization {
2121
private data: object = {};
2222
}
2323

24+
function get_user_cep_windows(): string {
25+
const appdata_output_temp = window.SupercellSWF.cwd + "program_data.txt";
26+
let status = FLfile.runCommandLine("echo %appdata% > \"" + FLfile.uriToPlatformPath(appdata_output_temp) + "\"");
27+
if (status != 1) return "";
28+
29+
const appdata_path = FLfile.platformPathToURI(FLfile.read(appdata_output_temp).split("\r\n")[0].trim());
30+
FLfile.remove(appdata_output_temp);
31+
32+
return appdata_path + "/Adobe/CEP/"
33+
}
34+
2435
(
2536
function () {
26-
let current_path = fl.scriptURI.replace("core/initialize_scope.jsfl", "");
37+
// @ts-ignore
38+
window.SupercellSWF = {
39+
cwd: fl.scriptURI.replace("core/initialize_scope.jsfl", ""),
40+
manifest: undefined,
41+
locale: undefined,
42+
user_cep: undefined,
43+
error_message: ""
44+
}
45+
46+
const [os, version] = fl.version.split(" ");
47+
if (os !== "WIN") {
48+
window.SupercellSWF.error_message = "Unsupported OS";
49+
}
2750

2851
// Initialize polyfills
29-
fl.runScript(current_path + "core/polyfill/string.jsfl")
30-
fl.runScript(current_path + "core/polyfill/array.jsfl")
31-
fl.runScript(current_path + "core/polyfill/JSON.jsfl")
32-
33-
// Initializing global object
34-
const manifest_path = current_path + "manifest.json";
35-
const global_object =
36-
{
37-
cwd: current_path,
38-
manifest: JSON.parse(FLfile.read(manifest_path)) as any,
39-
locale: new Localization(current_path)
52+
fl.runScript(window.SupercellSWF.cwd + "core/polyfill/string.jsfl")
53+
fl.runScript(window.SupercellSWF.cwd + "core/polyfill/array.jsfl")
54+
fl.runScript(window.SupercellSWF.cwd + "core/polyfill/JSON.jsfl")
55+
56+
// Reading Manifest
57+
window.SupercellSWF.manifest_path = window.SupercellSWF.cwd + "manifest.json";
58+
window.SupercellSWF.manifest = JSON.parse(FLfile.read(window.SupercellSWF.manifest_path)) as any;
59+
window.SupercellSWF.user_manifest_path = fl.configURI + window.SupercellSWF.manifest.name + ".manifest.json";
60+
window.SupercellSWF.user_manifest =
61+
FLfile.exists(window.SupercellSWF.user_manifest_path) ?
62+
JSON.parse(FLfile.read(window.SupercellSWF.user_manifest_path)) as any : undefined;
63+
64+
// Localization Init
65+
window.SupercellSWF.locale = new Localization();
66+
67+
// CEP Variables Init
68+
window.SupercellSWF.user_cep = () => {
69+
if (!window.SupercellSWF._user_cep) {
70+
window.SupercellSWF._user_cep = os == "WIN" ? get_user_cep_windows() : undefined;
71+
if (!window.SupercellSWF._user_cep) {
72+
window.SupercellSWF.error_message = "Failed to get path to CEP directory";
73+
}
74+
}
75+
76+
return window.SupercellSWF._user_cep;
4077
}
41-
window.SupercellSWF = global_object
4278
}
4379
)()
4480

installer/source/core/scripts/install/extension.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
function install_windows(extension: Extension) {
22
const package_path = FLfile.uriToPlatformPath(window.SupercellSWF.cwd + extension.path);
33
const archiver_bin = FLfile.uriToPlatformPath(window.SupercellSWF.cwd + "core/bin/windows/7z.exe");
4-
const program_data_file = window.SupercellSWF.cwd + "program_data.txt";
54
const unpack_log = window.SupercellSWF.cwd + "unpack_log.txt";
65

7-
FLfile.runCommandLine("echo %CommonProgramFiles% > \"" + FLfile.uriToPlatformPath(program_data_file) + "\"");
8-
const program_files_path = FLfile.platformPathToURI(FLfile.read(program_data_file).split("\r\n")[0].trim());
9-
FLfile.remove(program_data_file);
10-
11-
const extensions_folder = program_files_path + "/Adobe/CEP/extensions/";
6+
const extensions_folder = window.SupercellSWF.user_cep() + "extensions/";
127
const destination_folder = extensions_folder + extension.install;
138

149
if (FLfile.exists(destination_folder))
@@ -17,7 +12,7 @@ function install_windows(extension: Extension) {
1712
}
1813

1914
FLfile.createFolder(destination_folder);
20-
FLfile.runCommandLine("call \"" + archiver_bin + "\" x \"" + package_path + "\" -o\"" + FLfile.uriToPlatformPath(destination_folder) + "\" >> \"" + FLfile.uriToPlatformPath(unpack_log) + "\"")
15+
FLfile.runCommandLine("call \"" + archiver_bin + "\" x -y \"" + package_path + "\" -o\"" + FLfile.uriToPlatformPath(destination_folder) + "\" >> \"" + FLfile.uriToPlatformPath(unpack_log) + "\"")
2116
}
2217

2318
(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(
2+
function()
3+
{
4+
FLfile.copy(
5+
window.SupercellSWF.manifest_path,
6+
window.SupercellSWF.user_manifest_path
7+
);
8+
}
9+
)()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
(
2+
function()
3+
{
4+
const cep_path = window.SupercellSWF.user_cep();
5+
6+
for (const extension of window.SupercellSWF.user_manifest.extensions)
7+
{
8+
switch (extension.type)
9+
{
10+
case "extension":
11+
FLfile.remove(cep_path + "extensions/" + extension.install);
12+
break;
13+
14+
case "command":
15+
FLfile.remove(fl.configURI + "Commands/" + extension.install);
16+
break;
17+
}
18+
}
19+
20+
FLfile.remove(window.SupercellSWF.user_manifest_path);
21+
}
22+
)()

installer/source/flash/installer.fla

412 KB
Binary file not shown.

installer/source/flash/resources.fla

-1.27 MB
Binary file not shown.

installer/source/install.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
let current_path = fl.scriptURI.replace("install.jsfl", "");
1+
(
2+
function () {
3+
let current_path = fl.scriptURI.replace("install.jsfl", "");
24

3-
let dialog_path = current_path + "core/ui/install/installer.xul"
4-
fl.xmlPanel(dialog_path)
5+
let dialog_path = current_path + "core/ui/install/installer.xul"
6+
fl.xmlPanel(dialog_path)
7+
}
8+
)()

installer/source/scope.d.ts

+15
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,30 @@ declare global {
99
}
1010

1111
interface InstallManifest {
12+
name: string,
1213
version: string,
1314
extensions: Extension[]
1415
}
1516

1617
interface ManifestWindow extends Window {
1718
SupercellSWF?: {
1819
cwd: string,
20+
21+
// Package manifest
22+
manifest_path: string,
1923
manifest: InstallManifest,
24+
25+
// User manifest. Undefined when user already has installed extension
26+
user_manifest_path: string,
27+
user_manifest?: InstallManifest
28+
2029
locale: Localization,
30+
error_message: string,
31+
32+
// Path to CEP folder with user extensions
33+
user_cep: () => string,
34+
// cached variable
35+
_user_cep?: string,
2136
}
2237
}
2338

package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "SupercellSWF",
33
"private": true,
4-
"version": "1.2.0",
4+
"version": "1.2.1",
55
"description": "Custom platfrom plugin for Adobe Animate",
66
"main": "build.ts",
77
"scripts": {
@@ -12,11 +12,11 @@
1212
"author": "DaniilSV",
1313
"license": "MIT",
1414
"dependencies": {
15-
"@types/node": "^20.5.9",
16-
"picocolors": "^1.0.0",
17-
"registry-js": "^1.16.0",
18-
"ts-node": "^10.9.1",
19-
"url": "^0.11.0",
20-
"xmlbuilder2": "^3.0.2"
15+
"@types/node": "20.5.9",
16+
"picocolors": "1.0.0",
17+
"registry-js": "1.16.0",
18+
"ts-node": "10.9.1",
19+
"url": "0.11.0",
20+
"xmlbuilder2": "3.0.2"
2121
}
2222
}

plugin/build.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ mkdirSync(libPath, { recursive: true });
2020
const activeConfiguration = isDev ? "Debug" : "RelWithDebInfo"
2121

2222
const publisherName = "SupercellSWF"
23-
const publisherId = "com.scwmake.SupercellSWF.Publisher";
24-
const publisherUi = "com.scwmake.SupercellSWF.PublishSettings"
23+
const publisherId = "org.scWorkshop.SupercellSWF.Publisher";
24+
const publisherUi = "org.scWorkshop.SupercellSWF.PublishSettings"
2525

2626
const doctypeName = "SupercellSWF";
27-
const doctypeId = "com.scwmake.SupercellSWF";
27+
const doctypeId = "org.scWorkshop.SupercellSWF";
2828

2929
const assetsFolder = "resources"
3030

plugin/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "sc-animate-plugin",
2+
"name": "SupercellSWF-Animate-Native",
33
"version": "1.2.0",
44
"private": "true",
55
"description": "Native plugin for Adobe Animate",
@@ -11,8 +11,8 @@
1111
"author": "DaniilSV",
1212
"license": "MIT",
1313
"dependencies": {
14-
"@types/node": "^20.5.9",
15-
"@types/which": "^3.0.0",
16-
"which": "^3.0.0"
14+
"@types/node": "20.5.9",
15+
"@types/which": "3.0.0",
16+
"which": "3.0.0"
1717
}
1818
}

plugin/source/Module/PluginContext.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace sc
1515
{
1616
PluginContext::PluginContext()
1717
{
18-
const std::string log_name = std::string(DOCTYPE_UNIVERSAL_NAME "_log.txt");
18+
const std::string log_name = std::string(DOCTYPE_UNIVERSAL_NAME "_export_log.txt");
1919
const fs::path log_path = fs::temp_directory_path() / log_name;
2020

2121
if (fs::exists(log_path))

0 commit comments

Comments
 (0)