sách gpt4 ăn đã đi

object-c - Lập trình tạo gói/gói mac

In lại 作者:太空狗 更新时间:2023-10-30 03:25:27 28 4
mua khóa gpt4 giày nike

通过终端,您可以使用命令 - “SetFile -a B 文件名”

以编程方式,我认为我应该通过[[NSFileManager defaultManager] createDirectoryAtPath:dirPath withIntermediateDirectories:NO attributes:attributes error:nil];

但我找不到哪个。

Cảm ơn

câu trả lời hay nhất

能够以编程方式设置捆绑位仍然很有用,例如 iPhoto 这样做是为了使 iPhoto Library 文件夹显示为单个文件。

您可以使用 Carbon 文件管理器 API 以编程方式设置捆绑位。您需要确保您的应用链接到 Carbon 框架并导入 header 。这些调用是 64 位安全的。

- (void)setBundleBitOfFile:(NSString*)path toBool:(BOOL)newValue
{
const char* pathFSR = [path fileSystemRepresentation];
FSRef ref;
OSStatus err = FSPathMakeRef((const UInt8*)pathFSR, &ref, /*isDirectory*/ NULL);

if (err == noErr)
{
struct FSCatalogInfo catInfo;
union FinderInfoTransmuter finderInfoPointers = { .bytes = catInfo.finderInfo };

err = FSGetCatalogInfo(&ref,
kFSCatInfoFinderInfo,
&catInfo,
/*outName*/ NULL,
/*FSSpec*/ NULL,
/*parentRef*/ NULL);

if (err == noErr)
{
if (newValue)
finderInfoPointers.finderInfo->finderFlags |= kHasBundle;
khác
finderInfoPointers.finderInfo->finderFlags &= ~kHasBundle;

FSSetCatalogInfo(&ref,
kFSCatInfoFinderInfo,
&catInfo);
}
}
}

- (BOOL)bundleBitOfFile:(NSString*)path
{
BOOL value = NO;

const char* pathFSR = [path fileSystemRepresentation];
FSRef ref;
OSStatus err = FSPathMakeRef((const UInt8*)pathFSR, &ref, /*isDirectory*/ NULL);

if (err == noErr)
{
struct FSCatalogInfo catInfo;
union FinderInfoTransmuter finderInfoPointers = { .bytes = catInfo.finderInfo };

err = FSGetCatalogInfo(&ref,
kFSCatInfoFinderInfo,
&catInfo,
/*outName*/ NULL,
/*FSSpec*/ NULL,
/*parentRef*/ NULL);

if (err == noErr)
{
value = (BOOL)(((finderInfoPointers.finderInfo->finderFlags) & kHasBundle) == kHasBundle);
}
}

return value;
}

关于objective-c - 以编程方式制作 mac 包/包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2009687/

28 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress