ani-cli-npm 2.0.7 → 2.0.8

Sign up to get free protection for your applications and to get access to all the features.
package/bin/index.js CHANGED
@@ -15,7 +15,6 @@ const load_config_1 = require("./load_config");
15
15
  const input_1 = require("./input");
16
16
  const change_config_1 = require("./change_config");
17
17
  const download_1 = require("./download");
18
- const fs_1 = __importDefault(require("fs"));
19
18
  const app_data_folder = (0, appdata_path_1.default)();
20
19
  const cache_folder = app_data_folder + "/ani-cli-npm";
21
20
  (0, load_config_1.make_config_dir)(cache_folder, true);
@@ -88,7 +87,13 @@ async function main() {
88
87
  config = temp;
89
88
  //proxyAgent = new HttpsProxyAgent(config.proxy);
90
89
  console.clear();
91
- console.log(chalk.yellow("Config changed."));
90
+ try {
91
+ (0, load_config_1.write_config)(cache_folder, config);
92
+ console.log(chalk.yellow("Config changed."));
93
+ }
94
+ catch {
95
+ console.log(chalk.red("Error writing to .conf file."));
96
+ }
92
97
  break;
93
98
  }
94
99
  else if (exit_code === 2) {
@@ -98,12 +103,6 @@ async function main() {
98
103
  break;
99
104
  }
100
105
  }
101
- try {
102
- fs_1.default.writeFileSync(cache_folder + "/config.conf", JSON.stringify(config));
103
- }
104
- catch {
105
- console.log(chalk.red("Error writing to .conf file."));
106
- }
107
106
  await main();
108
107
  break;
109
108
  case 4: // Quit
@@ -40,7 +40,7 @@ exports.make_config_dir = make_config_dir;
40
40
  function write_config(cache_dir, config) {
41
41
  try {
42
42
  //make_config_dir(cache_dir, config.debug_mode)
43
- fs.writeFileSync(cache_dir + "/config.conf", JSON.stringify(config));
43
+ fs.writeFileSync(cache_dir + "/config.conf", JSON.stringify(config), "utf-8");
44
44
  }
45
45
  catch {
46
46
  console.log(("Failed to write to config file."));
@@ -59,9 +59,9 @@ function load_config(cache_dir) {
59
59
  download_folder: ".",
60
60
  debug_mode: false
61
61
  };
62
- if (fs.existsSync(cache_dir + "/ani-cli-npm/config.conf")) {
62
+ if (fs.existsSync(cache_dir + "/config.conf")) {
63
63
  // @ts-ignore
64
- let tmp = JSON.parse(fs.readFileSync(cache_dir + "/ani-cli-npm/config.conf"), "utf8");
64
+ let tmp = JSON.parse(fs.readFileSync(cache_dir + "/config.conf"), "utf8");
65
65
  // @ts-ignore
66
66
  if (tmp.player !== undefined)
67
67
  config.player = tmp.player;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ani-cli-npm",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "description": "ani-cli tool rewritten as npm package",
5
5
  "main": "bin/index.js",
6
6
  "scripts": {