@@ -24,6 +24,7 @@ const Plugins = require('./plugins.js');
2424const DBUtils = require ( './helpers/db.utils.js' ) ;
2525const Site = require ( './site.js' ) ;
2626const Utils = require ( './helpers/utils.js' ) ;
27+ const FileHelper = require ( './helpers/file.js' ) ;
2728// List of the Event classes
2829const EventClasses = require ( './events/_modules.js' ) ;
2930// Migration classes
@@ -52,7 +53,7 @@ class App {
5253 this . initPath = path . join ( this . appDir , 'config' , 'window-config.json' ) ;
5354 this . appConfigPath = path . join ( this . appDir , 'config' , 'app-config.json' ) ;
5455 this . tinymceOverridedConfigPath = path . join ( this . appDir , 'config' , 'tinymce.override.json' ) ;
55- this . versionData = JSON . parse ( fs . readFileSync ( __dirname + '/builddata.json' , 'utf8' ) ) ;
56+ this . versionData = JSON . parse ( FileHelper . readFileSync ( __dirname + '/builddata.json' , 'utf8' ) ) ;
5657 this . versionData . os = os . platform ( ) === 'darwin' ? 'mac' : os . platform ( ) === 'linux' ? 'linux' : 'win' ;
5758 this . windowBounds = null ;
5859 this . appConfig = null ;
@@ -166,8 +167,8 @@ class App {
166167
167168 // Check if both config.json files exists
168169 if ( fs . existsSync ( appThemeConfig ) && fs . existsSync ( userThemeConfig ) ) {
169- let appThemeData = JSON . parse ( fs . readFileSync ( appThemeConfig , 'utf8' ) ) ;
170- let userThemeData = JSON . parse ( fs . readFileSync ( userThemeConfig , 'utf8' ) ) ;
170+ let appThemeData = JSON . parse ( FileHelper . readFileSync ( appThemeConfig , 'utf8' ) ) ;
171+ let userThemeData = JSON . parse ( FileHelper . readFileSync ( userThemeConfig , 'utf8' ) ) ;
171172
172173 // If app theme is newer version than the existing one
173174 if ( compare ( appThemeData . version , userThemeData . version ) === 1 ) {
@@ -232,7 +233,7 @@ class App {
232233 let themeDir = path . join ( siteDir , 'input' , 'themes' , themes . currentTheme ( true ) ) ;
233234 let themeOverridesDir = path . join ( siteDir , 'input' , 'themes' , themes . currentTheme ( true ) + '-override' ) ;
234235 let themeConfig = Themes . loadThemeConfig ( themeConfigPath , themeDir ) ;
235- let menuStructure = fs . readFileSync ( menuConfigPath , 'utf8' ) ;
236+ let menuStructure = FileHelper . readFileSync ( menuConfigPath , 'utf8' ) ;
236237 let parsedMenuStructure = { } ;
237238
238239 try {
@@ -284,7 +285,7 @@ class App {
284285
285286 // Load the config
286287 let defaultSiteConfig = JSON . parse ( JSON . stringify ( defaultAstCurrentSiteConfig ) ) ;
287- let siteConfig = fs . readFileSync ( configFilePath ) ;
288+ let siteConfig = FileHelper . readFileSync ( configFilePath ) ;
288289 siteConfig = JSON . parse ( siteConfig ) ;
289290
290291 if ( siteConfig . name !== siteName ) {
@@ -438,7 +439,7 @@ class App {
438439 loadConfig ( ) {
439440 // Try to get window bounds
440441 try {
441- this . windowBounds = JSON . parse ( fs . readFileSync ( this . initPath , 'utf8' ) ) ;
442+ this . windowBounds = JSON . parse ( FileHelper . readFileSync ( this . initPath , 'utf8' ) ) ;
442443 } catch ( e ) {
443444 console . log ( 'The window-config.json file will be created' ) ;
444445 }
@@ -491,7 +492,7 @@ class App {
491492
492493 // Try to get application config
493494 try {
494- this . appConfig = JSON . parse ( fs . readFileSync ( this . appConfigPath , 'utf8' ) ) ;
495+ this . appConfig = JSON . parse ( FileHelper . readFileSync ( this . appConfigPath , 'utf8' ) ) ;
495496 this . appConfig = Utils . mergeObjects ( JSON . parse ( JSON . stringify ( defaultAstAppConfig ) ) , this . appConfig ) ;
496497 } catch ( e ) {
497498 if ( this . hasPermissionsErrors ( e ) ) {
@@ -519,7 +520,7 @@ class App {
519520 loadAdditionalConfig ( ) {
520521 // Try to get TinyMCE overrided config
521522 try {
522- this . tinymceOverridedConfig = JSON . parse ( fs . readFileSync ( this . tinymceOverridedConfigPath , 'utf8' ) ) ;
523+ this . tinymceOverridedConfig = JSON . parse ( FileHelper . readFileSync ( this . tinymceOverridedConfigPath , 'utf8' ) ) ;
523524 } catch ( e ) { }
524525
525526 if ( this . appConfig . sitesLocation ) {
0 commit comments