import type { Project } from '../types/app';
export type SettingsProject = Pick<Project, 'name' | 'displayName' | 'fullPath' | 'path'>;
export const normalizeProjectForSettings = (project: Project): SettingsProject => {
const fallbackPath =
typeof project.fullPath === 'string' && project.fullPath.length > 0
? project.fullPath
: typeof project.path === 'string'
? project.path
: '';
return {
name: project.name,
displayName:
typeof project.displayName === 'string' && project.displayName.trim().length > 0
? project.displayName
: project.name,
fullPath: fallbackPath,
path:
typeof project.path === 'string' && project.path.length > 0
? project.path
: fallbackPath,
};
};