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

gitify-app / gitify / 12340322989

15 Dec 2024 04:10PM UTC coverage: 87.342%. Remained the same
12340322989

Pull #1643

github

web-flow
Merge 67ddbb2f2 into 3d6b2bab6
Pull Request #1643: fix(deps): update dependency react-router-dom to v7

585 of 648 branches covered (90.28%)

Branch coverage included in aggregate %.

1561 of 1809 relevant lines covered (86.29%)

24.57 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
import log from 'electron-log';
×
5

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

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

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

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

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

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

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

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

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

50
    fs.writeFileSync(configPath, '');
×
51
  } catch (error) {
52
    log.error('First run: Unable to write firstRun file', error);
×
53
  }
54

55
  return true;
×
56
}
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