Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
folium-app
GitHub Repository: folium-app/Folium
Path: blob/a-new-beginning/Folium-iOS/Classes/Games/GameDetails.swift
2 views
//
//  GameDetails.swift
//  Folium-iOS
//
//  Created by Jarrod Norwell on 10/3/2026.
//

import Foundation

struct GameDetails : Codable {
    let artworkAspectRatio,
        displayAspectRatio: CGFloat
    let `extension`, size: String
    var name: String
    let url: URL
    
    init(cartridge: URL) {
        let formatter: ByteCountFormatter = ByteCountFormatter()
        formatter.countStyle = .file
        
        artworkAspectRatio = 30 / 41
        displayAspectRatio = 256 / 192
        `extension` = cartridge.pathExtension
        name = cartridge.deletingPathExtension().lastPathComponent
        size = "0 KB" // temp
        /*
        do {
            let attributes: [FileAttributeKey : Any] = try FileManager.default.attributesOfItem(atPath: cartridge.path)
            if let byteCount: Int64 = attributes[.size] as? Int64 {
                size = formatter.string(fromByteCount: byteCount)
            } else {
                size = formatter.string(fromByteCount: 0)
            }
        } catch {
            size = formatter.string(fromByteCount: 0)
        }
         */
        url = cartridge
    }
}