INNER CODE UNIT · TypeScript

selection

SimonAKing/scrcpy-gui · src/main/main.ts:654

    const selection = await dialog.showOpenDialog({
      title: 'Import launch profile', properties: ['openFile'],
      filters: [{ name: 'Scrcpy GUI profile', extensions: ['json'] }]
    })
    if (selection.canceled || !selection.filePaths[0]) {
      return operationFailure('PROFILE_IMPORT_CANCELED', 'profile-import-preview', 'Profile import canceled.')
    }
    const contents = await readBoundedRegularUtf8File(
      selection.filePaths[0],
      2 * 1024 * 1024,
      'Profile file must be a regular file no larger than 2 MiB.'
    )
    const snapshot = configRepository?.snapshot()
    if (!snapshot) throw new Error('Configuration repository is not ready.')
    const environment = await getEnvironment(runtimeConfig(runtime))
    const selectedVersion = environment.scrcpy.version.match(/\b(\d+\.\d+(?:\.\d+)?)/)?.[1] || '0.0'
    return {
      ok: true,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…