Как я отмечаю папку, как являющуюся пакетом?

старый вопрос, но ничей упомянутый nullability, который является важным аспектом Алгебраических типов данных, возможно, самый важный аспект. Начиная с каждого значения большинство быть одной из альтернатив, исчерпывающее основанное на случае сопоставление с образцом возможно.

6
задан Pierre Bernard 18 November 2009 в 14:29
поделиться

3 ответа

Although you should not rely solely upon it, one thing to do is set the file's bundle bit. I've got a category on NSWorkspace to do just that:

- (void)setBundleBit:(BOOL)flag forFile:(NSString *)path
{
    FSRef fileRef;
    OSErr error = FSPathMakeRef((UInt8 *)[path fileSystemRepresentation], &fileRef, NULL);

    // Get the file's current info
    FSCatalogInfo fileInfo;
    if (!error)
    {
        error = FSGetCatalogInfo(&fileRef, kFSCatInfoFinderInfo, &fileInfo, NULL, NULL, NULL);
    }

    if (!error)
    {
        // Adjust the bundle bit
        FolderInfo *finderInfo = (FolderInfo *)fileInfo.finderInfo;
        if (flag) {
            finderInfo->finderFlags |= kHasBundle;
        }
        else {
            finderInfo->finderFlags &= ~kHasBundle;
        }

        // Set the altered flags of the file
        error = FSSetCatalogInfo(&fileRef, kFSCatInfoFinderInfo, &fileInfo);
    }

    if (error) {
        NSLog(@"OSError %i in -[NSWorkspace setBundleBit:forFile:]", error);
    }
}
7
ответ дан 10 December 2019 в 00:39
поделиться

File and protocol are, to the best of my knowledge, only setup inside your apps Info.plist.

Apps get scanned, and the info in their plists get's added to LaunchServices settings.

Linkinus has 6 different Document Types declared, TextMate has 97, and CyberDuck has 3. I'll do some more searching but I think this is likely the preferred method.

2
ответ дан 10 December 2019 в 00:39
поделиться

Есть две команды, которые могут быть интересны:

GetFileInfo iPhoto\ Library

attributes: avBstclinmedz

B говорит, что установлен бит "bundle". Команда SetFile позволяет вам установить их. Это позволяет вам получить доступ к расширенным атрибутам в HFS + (согласно странице руководства).

Вот возможные атрибуты:

A   Alias file
B   Bundle
C   Custom icon*
D   Desktop*
E   Hidden extension*
I   Inited*
M   Shared (can run multiple times)
N   No INIT resources
L   Locked
S   System (name locked)
T   Stationery
V   Invisible*
Z   Busy*
1
ответ дан 10 December 2019 в 00:39
поделиться
Другие вопросы по тегам:

Похожие вопросы: