• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gitify-app / gitify / 12586431667

02 Jan 2025 05:40PM UTC coverage: 87.209%. Remained the same
12586431667

Pull #1700

github

web-flow
Merge 35a8d97a0 into 0e8d27442
Pull Request #1700: build(deps): bump cross-spawn from 7.0.3 to 7.0.6

591 of 656 branches covered (90.09%)

Branch coverage included in aggregate %.

1584 of 1838 relevant lines covered (86.18%)

24.61 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/first-run.ts
1
import fs from 'node:fs';
×
2
import path from 'node:path';
×
3
import { app, dialog } from 'electron';
×
4

5
import { logError } from '../shared/logger';
×
6

7
export async function onFirstRunMaybe() {
×
8
  if (isFirstRun()) {
×
9
    await promptMoveToApplicationsFolder();
×
10
  }
11
}
12

13
// Ask user if the app should be moved to the applications folder.
14
async function promptMoveToApplicationsFolder() {
15
  if (process.platform !== 'darwin') return;
×
16

17
  const isDevMode = !!process.defaultApp;
×
18
  if (isDevMode || app.isInApplicationsFolder()) return;
×
19

20
  const { response } = await dialog.showMessageBox({
×
21
    type: 'question',
22
    buttons: ['Move to Applications Folder', 'Do Not Move'],
23
    defaultId: 0,
24
    message: 'Move to Applications Folder?',
25
  });
26

27
  if (response === 0) {
×
28
    app.moveToApplicationsFolder();
×
29
  }
30
}
31

32
const getConfigPath = () => {
×
33
  const userDataPath = app.getPath('userData');
×
34
  return path.join(userDataPath, 'FirstRun', 'gitify-first-run');
×
35
};
36

37
// Whether or not the app is being run for the first time.
38
function isFirstRun() {
39
  const configPath = getConfigPath();
×
40

41
  try {
×
42
    if (fs.existsSync(configPath)) {
×
43
      return false;
×
44
    }
45

46
    const firstRunFolder = path.dirname(configPath);
×
47
    if (!fs.existsSync(firstRunFolder)) {
×
48
      fs.mkdirSync(firstRunFolder);
×
49
    }
50

51
    fs.writeFileSync(configPath, '');
×
52
  } catch (err) {
53
    logError('isFirstRun', 'Unable to write firstRun file', err);
×
54
  }
55

56
  return true;
×
57
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc