dashcam 1.3.17-beta → 1.3.19-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,11 +11,33 @@ import fs from 'fs';
11
11
  import path from 'path';
12
12
  import os from 'os';
13
13
 
14
- // Get process directory for status files (system temp for cross-session access)
15
- const PROCESS_DIR = path.join(os.tmpdir(), 'dashcam-cli');
14
+ // Use a consistent location across all contexts
15
+ // Windows: C:\ProgramData\dashcam-cli (shared across all users/sessions)
16
+ // Others: /tmp/dashcam-cli (standard temp location)
17
+ const getProcessDir = () => {
18
+ if (process.platform === 'win32') {
19
+ // Use PROGRAMDATA which is consistent across all contexts on Windows
20
+ const programData = process.env.PROGRAMDATA || 'C:\\ProgramData';
21
+ return path.join(programData, 'dashcam-cli');
22
+ } else {
23
+ // Use /tmp directly on Unix-like systems for consistency
24
+ return '/tmp/dashcam-cli';
25
+ }
26
+ };
27
+
28
+ const PROCESS_DIR = getProcessDir();
16
29
  const STATUS_FILE = path.join(PROCESS_DIR, 'status.json');
17
30
  const RESULT_FILE = path.join(PROCESS_DIR, 'upload-result.json');
18
31
 
32
+ console.log('[Background INIT] Process directory:', PROCESS_DIR);
33
+ console.log('[Background INIT] Status file:', STATUS_FILE);
34
+
35
+ // Ensure directory exists
36
+ if (!fs.existsSync(PROCESS_DIR)) {
37
+ console.log('[Background INIT] Creating process directory');
38
+ fs.mkdirSync(PROCESS_DIR, { recursive: true });
39
+ }
40
+
19
41
  // Parse options from command line argument
20
42
  const optionsJson = process.argv[2];
21
43
  if (!optionsJson) {
package/bin/dashcam.js CHANGED
@@ -37,6 +37,17 @@ program
37
37
  }
38
38
  });
39
39
 
40
+ // Add a dedicated version command that shows more details
41
+ program
42
+ .command('version')
43
+ .description('Show version information')
44
+ .action(() => {
45
+ console.log(`Dashcam CLI v${APP.version}`);
46
+ console.log(`Node.js ${process.version}`);
47
+ console.log(`Platform: ${process.platform} ${process.arch}`);
48
+ process.exit(0);
49
+ });
50
+
40
51
  program
41
52
  .command('auth')
42
53
  .description("Authenticate the dashcam desktop using a team's apiKey")
@@ -399,7 +410,9 @@ program
399
410
  platform: process.platform,
400
411
  cwd: process.cwd(),
401
412
  pid: process.pid,
402
- processDir: require('path').join(require('os').tmpdir(), 'dashcam-cli')
413
+ processDir: process.platform === 'win32'
414
+ ? require('path').join(process.env.PROGRAMDATA || 'C:\\ProgramData', 'dashcam-cli')
415
+ : '/tmp/dashcam-cli'
403
416
  });
404
417
 
405
418
  const isActive = processManager.isRecordingActive();
@@ -407,15 +420,19 @@ program
407
420
 
408
421
  if (!isActive) {
409
422
  console.log('No active recording to stop');
423
+
424
+ const statusPath = process.platform === 'win32'
425
+ ? require('path').join(process.env.PROGRAMDATA || 'C:\\ProgramData', 'dashcam-cli', 'status.json')
426
+ : '/tmp/dashcam-cli/status.json';
427
+
410
428
  logger.warn('Stop command called but no active recording found', {
411
429
  platform: process.platform,
412
- statusFile: require('path').join(require('os').tmpdir(), 'dashcam-cli', 'status.json'),
413
- statusFileExists: require('fs').existsSync(require('path').join(require('os').tmpdir(), 'dashcam-cli', 'status.json'))
430
+ statusFile: statusPath,
431
+ statusFileExists: require('fs').existsSync(statusPath)
414
432
  });
415
433
 
416
434
  // Try to read and display status file for debugging
417
435
  try {
418
- const statusPath = require('path').join(require('os').tmpdir(), 'dashcam-cli', 'status.json');
419
436
  if (require('fs').existsSync(statusPath)) {
420
437
  const statusContent = require('fs').readFileSync(statusPath, 'utf8');
421
438
  logger.debug('Status file contents', { content: statusContent });
@@ -8,14 +8,35 @@ import { logger } from './logger.js';
8
8
  const __filename = fileURLToPath(import.meta.url);
9
9
  const __dirname = path.dirname(__filename);
10
10
 
11
- // Use system temp directory for cross-session communication
12
- const PROCESS_DIR = path.join(os.tmpdir(), 'dashcam-cli');
11
+ // Use a consistent location across all contexts
12
+ // Windows: C:\ProgramData\dashcam-cli (shared across all users/sessions)
13
+ // Others: /tmp/dashcam-cli (standard temp location)
14
+ const getProcessDir = () => {
15
+ if (process.platform === 'win32') {
16
+ // Use PROGRAMDATA which is consistent across all contexts on Windows
17
+ const programData = process.env.PROGRAMDATA || 'C:\\ProgramData';
18
+ return path.join(programData, 'dashcam-cli');
19
+ } else {
20
+ // Use /tmp directly on Unix-like systems for consistency
21
+ return '/tmp/dashcam-cli';
22
+ }
23
+ };
24
+
25
+ const PROCESS_DIR = getProcessDir();
13
26
  const STATUS_FILE = path.join(PROCESS_DIR, 'status.json');
14
27
  const RESULT_FILE = path.join(PROCESS_DIR, 'upload-result.json');
15
28
 
29
+ console.log('[INIT] Process Manager initialized');
30
+ console.log('[INIT] Process directory:', PROCESS_DIR);
31
+ console.log('[INIT] Status file:', STATUS_FILE);
32
+ console.log('[INIT] Platform:', process.platform);
33
+
16
34
  // Ensure process directory exists
17
35
  if (!fs.existsSync(PROCESS_DIR)) {
36
+ console.log('[INIT] Creating process directory:', PROCESS_DIR);
18
37
  fs.mkdirSync(PROCESS_DIR, { recursive: true });
38
+ } else {
39
+ console.log('[INIT] Process directory exists:', PROCESS_DIR);
19
40
  }
20
41
 
21
42
  class ProcessManager {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dashcam",
3
- "version": "1.3.17-beta",
3
+ "version": "1.3.19-beta",
4
4
  "description": "Minimal CLI version of Dashcam desktop app",
5
5
  "main": "bin/dashcam.js",
6
6
  "bin": {