basic poc app
This commit is contained in:
1 parent
4a2d58f189
commit
59670cb841
6 files changed
+315
-28
No files matched your search
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// SymHandler.swift
|
||||
// Pocket Poster
|
||||
//
|
||||
// Created by lemin on 5/31/25.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
class SymHandler {
|
||||
// MARK: URL Getter Operations
|
||||
static func getDocumentsDirectory() -> URL {
|
||||
let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
|
||||
let documentsDirectory = paths[0]
|
||||
return documentsDirectory
|
||||
}
|
||||
|
||||
private static func getSymlinkURL() -> URL {
|
||||
return getDocumentsDirectory().appendingPathComponent(".Trash", conformingTo: .symbolicLink)
|
||||
}
|
||||
|
||||
// MARK: Symlink Creation
|
||||
static func createSymlink(to path: String) throws -> URL {
|
||||
// returns the url of the symlink
|
||||
let symURL = getSymlinkURL()
|
||||
cleanup()
|
||||
|
||||
// create the symlink to the hashed app folder
|
||||
try FileManager.default.createSymbolicLink(at: symURL, withDestinationURL: URL(fileURLWithPath: path, isDirectory: true))
|
||||
|
||||
return symURL
|
||||
}
|
||||
|
||||
static func createAppSymlink(for appHash: String) throws -> URL {
|
||||
return try createSymlink(to: "/var/mobile/Containers/Data/Application/\(appHash)")
|
||||
}
|
||||
|
||||
static func createDescriptorsSymlink(appHash: String) throws -> URL {
|
||||
// create a symlink directly to the descriptors
|
||||
return try createAppSymlink(for: "\(appHash)/Library/Application Support/PRBPosterExtensionDataStore/61/Extensions/com.apple.WallpaperKit.CollectionsPoster/descriptors")
|
||||
}
|
||||
|
||||
static func cleanup() {
|
||||
// remove the symlink if it exists
|
||||
let symURL = getSymlinkURL()
|
||||
// remove existing symlink
|
||||
try? FileManager.default.removeItem(at: symURL)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user