Skip to content

Commit

Permalink
fix file not found error
Browse files Browse the repository at this point in the history
  • Loading branch information
drecodeam committed Aug 31, 2018
1 parent f665fb8 commit e1972d5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/app/components/home/home.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ $haiti : #170139;
overflow: hidden;
font-family: $font-sans-serif;
color: $pelorous;
color: white;
background: transparent;
background: linear-gradient(270deg, darken( #F97C24, 10% ), darken( #D9497D, 10%));

.message {
font-weight: 400;
display: inline-block;
Expand Down
13 changes: 7 additions & 6 deletions src/app/components/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class HomeComponent implements OnInit, AfterViewInit {
}

// COMMONLY USED ELECTRON SERVICE REFERENCES
filePath = this.electronService.remote.app.getPath('appData') + '/list.json';
filePath = this.electronService.remote.app.getPath('appData') + '/list2.json';
fs = this.electronService.fs;
app = this.electronService.remote.app;
window = this.electronService.remote.getCurrentWindow();
Expand Down Expand Up @@ -220,6 +220,10 @@ export class HomeComponent implements OnInit, AfterViewInit {
getCurrentList() {
try {
this.data = JSON.parse(this.fs.readFileSync(this.filePath).toString());
return this.data;
} catch (error) {
// if there was some kind of error, return the passed in defaults instead.
console.log('there seems to be an issue getting the current data');
if (!this.data) {
this.data = {
hideOnboarding: false,
Expand All @@ -228,10 +232,6 @@ export class HomeComponent implements OnInit, AfterViewInit {
this.fs.writeFileSync(this.filePath, this.data, 'utf-8');
}
return this.data;
} catch (error) {
// if there was some kind of error, return the passed in defaults instead.
console.log('there seems to be an issue getting the current data');
return false;
}
}

Expand Down Expand Up @@ -458,7 +458,8 @@ export class HomeComponent implements OnInit, AfterViewInit {
}

ngOnInit() {
this.getCurrentList();
const data = this.getCurrentList();
console.log( 'data is' + data );
this.sanitizeData();
this.updateData();
}
Expand Down

0 comments on commit e1972d5

Please sign in to comment.