@@ -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 . windowBounds = null ;
5758 this . appConfig = null ;
5859 this . tinymceOverridedConfig = { } ;
@@ -165,8 +166,8 @@ class App {
165166
166167 // Check if both config.json files exists
167168 if ( fs . existsSync ( appThemeConfig ) && fs . existsSync ( userThemeConfig ) ) {
168- let appThemeData = JSON . parse ( fs . readFileSync ( appThemeConfig , 'utf8' ) ) ;
169- let userThemeData = JSON . parse ( fs . readFileSync ( userThemeConfig , 'utf8' ) ) ;
169+ let appThemeData = JSON . parse ( FileHelper . readFileSync ( appThemeConfig , 'utf8' ) ) ;
170+ let userThemeData = JSON . parse ( FileHelper . readFileSync ( userThemeConfig , 'utf8' ) ) ;
170171
171172 // If app theme is newer version than the existing one
172173 if ( compare ( appThemeData . version , userThemeData . version ) === 1 ) {
@@ -231,7 +232,7 @@ class App {
231232 let themeDir = path . join ( siteDir , 'input' , 'themes' , themes . currentTheme ( true ) ) ;
232233 let themeOverridesDir = path . join ( siteDir , 'input' , 'themes' , themes . currentTheme ( true ) + '-override' ) ;
233234 let themeConfig = Themes . loadThemeConfig ( themeConfigPath , themeDir ) ;
234- let menuStructure = fs . readFileSync ( menuConfigPath , 'utf8' ) ;
235+ let menuStructure = FileHelper . readFileSync ( menuConfigPath , 'utf8' ) ;
235236 let parsedMenuStructure = { } ;
236237
237238 try {
@@ -283,7 +284,7 @@ class App {
283284
284285 // Load the config
285286 let defaultSiteConfig = JSON . parse ( JSON . stringify ( defaultAstCurrentSiteConfig ) ) ;
286- let siteConfig = fs . readFileSync ( configFilePath ) ;
287+ let siteConfig = FileHelper . readFileSync ( configFilePath ) ;
287288 siteConfig = JSON . parse ( siteConfig ) ;
288289
289290 if ( siteConfig . name !== siteName ) {
@@ -437,7 +438,7 @@ class App {
437438 loadConfig ( ) {
438439 // Try to get window bounds
439440 try {
440- this . windowBounds = JSON . parse ( fs . readFileSync ( this . initPath , 'utf8' ) ) ;
441+ this . windowBounds = JSON . parse ( FileHelper . readFileSync ( this . initPath , 'utf8' ) ) ;
441442 } catch ( e ) {
442443 console . log ( 'The window-config.json file will be created' ) ;
443444 }
@@ -490,7 +491,7 @@ class App {
490491
491492 // Try to get application config
492493 try {
493- this . appConfig = JSON . parse ( fs . readFileSync ( this . appConfigPath , 'utf8' ) ) ;
494+ this . appConfig = JSON . parse ( FileHelper . readFileSync ( this . appConfigPath , 'utf8' ) ) ;
494495 this . appConfig = Utils . mergeObjects ( JSON . parse ( JSON . stringify ( defaultAstAppConfig ) ) , this . appConfig ) ;
495496 } catch ( e ) {
496497 if ( this . hasPermissionsErrors ( e ) ) {
@@ -518,7 +519,7 @@ class App {
518519 loadAdditionalConfig ( ) {
519520 // Try to get TinyMCE overrided config
520521 try {
521- this . tinymceOverridedConfig = JSON . parse ( fs . readFileSync ( this . tinymceOverridedConfigPath , 'utf8' ) ) ;
522+ this . tinymceOverridedConfig = JSON . parse ( FileHelper . readFileSync ( this . tinymceOverridedConfigPath , 'utf8' ) ) ;
522523 } catch ( e ) { }
523524
524525 if ( this . appConfig . sitesLocation ) {
0 commit comments