Skip to content
This repository has been archived by the owner on Jun 6, 2022. It is now read-only.

Commit

Permalink
Add some logging to importers
Browse files Browse the repository at this point in the history
  • Loading branch information
doZennn committed Sep 12, 2019
1 parent c90f432 commit 884fb2e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/js/importers/BattleNet.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const Registry = window.require('winreg');
const fs = window.require('fs');
const path = window.require('path');
const log = window.require('electron-log');
import decoder from 'blizzard-product-parser/src/js/database'; // Workaround for badly configured lib

const BNET_GAMES = {
Expand Down Expand Up @@ -118,6 +119,7 @@ class BattleNet {

static getGames() {
return new Promise((resolve, reject) => {
log.info('Import: Started bnet');
this.getBattlenetPath().then((bnetPath) => {
const games = [];
const bnetExe = path.join(bnetPath, 'Battle.net.exe');
Expand All @@ -136,12 +138,12 @@ class BattleNet {

installed.forEach((product) => {
const gameId = product.uid;
const launchIdLower = product.productCode.toLowerCase();
if (BNET_GAMES[launchIdLower]) {
const launchId = BNET_GAMES[launchIdLower].launchId;
const name = BNET_GAMES[launchIdLower].name;
const exes = BNET_GAMES[launchIdLower].exes;
const icon = path.join(product.settings.installPath, BNET_GAMES[launchIdLower].icon);
const productCode = product.productCode.toLowerCase();
if (BNET_GAMES[productCode]) {
const launchId = BNET_GAMES[productCode].launchId;
const name = BNET_GAMES[productCode].name;
const exes = BNET_GAMES[productCode].exes;
const icon = path.join(product.settings.installPath, BNET_GAMES[productCode].icon);
games.push({
id: gameId,
name: name,
Expand Down
2 changes: 2 additions & 0 deletions src/js/importers/Epic.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const fs = window.require('fs');
const path = window.require('path');
const jsonminify = window.require('jsonminify');
const {arch} = window.require('os');
const log = window.require('electron-log');

class Epic {
static isInstalled() {
Expand Down Expand Up @@ -47,6 +48,7 @@ class Epic {

static getGames() {
return new Promise((resolve, reject) => {
log.info('Import: Started egs');
this.getEpicPath().then((epicPath) => {
// Get path to LauncherAutoClose.ps1
let launcherWatcher = path.resolve(path.dirname(process.resourcesPath), '../../../', 'LauncherAutoClose.ps1');
Expand Down
2 changes: 2 additions & 0 deletions src/js/importers/Gog.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const Registry = window.require('winreg');
const fs = window.require('fs');
const promiseReflect = window.require('promise-reflect');
const log = window.require('electron-log');

class Gog {
static isInstalled() {
Expand Down Expand Up @@ -83,6 +84,7 @@ class Gog {

static getGames() {
return new Promise((resolve, reject) => {
log.info('Import: Started gog');
this.getGogPath().then(() => {
const reg = new Registry({
hive: Registry.HKLM,
Expand Down
2 changes: 2 additions & 0 deletions src/js/importers/Origin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const path = window.require('path');
const querystring = window.require('querystring');
const xml2js = window.require('xml-js').xml2js;
const iconv = window.require('iconv-lite');
const log = window.require('electron-log');

class Origin {
static isInstalled() {
Expand Down Expand Up @@ -80,6 +81,7 @@ class Origin {

static getGames() {
return new Promise((resolve, reject) => {
log.info('Import: Started origin');
this.getOriginPath().then((originPath) => {
const originDataPath = 'C:\\ProgramData\\Origin';
const games = [];
Expand Down
2 changes: 2 additions & 0 deletions src/js/importers/Uplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const Registry = window.require('winreg');
const yaml = window.require('js-yaml');
const fs = window.require('fs');
const path = window.require('path');
const log = window.require('electron-log');

class Uplay {
static isInstalled() {
Expand Down Expand Up @@ -249,6 +250,7 @@ class Uplay {

static getGames() {
return new Promise((resolve, reject) => {
log.info('Import: Started uplay');
// Get path to LauncherAutoClose.ps1
let launcherWatcher = path.resolve(path.dirname(process.resourcesPath), '../../../', 'LauncherAutoClose.ps1');
if (!fs.existsSync(launcherWatcher)) {
Expand Down

0 comments on commit 884fb2e

Please sign in to comment.