简体   繁体   English

如何从目录ID和卷号中找到FSRef?

[英]How to find an FSRef from a directory ID and a volume number?

Given an FSRef of a directory, one can use FSGetCatalogInfo to find the volume reference number and the directory ID. 给定目录的FSRef,可以使用FSGetCatalogInfo查找卷引用号和目录ID。 Together, these two numbers should be enough to identify the directory. 这两个数字应该足以识别目录。 One way to go the other direction would be use FSMakeFSSpec( vRefNum, dirID, "\\p", &fileSpec ) and then FSpMakeFSRef( &fileSpec, &dirRef ) . 另一个方向是使用FSMakeFSSpec( vRefNum, dirID, "\\p", &fileSpec ) ,然后使用FSpMakeFSRef( &fileSpec, &dirRef ) However, FSMakeFSSpec and FSpMakeFSRef are deprecated. 但是,不推荐使用FSMakeFSSpecFSpMakeFSRef I'm wondering whether there is a way to go from vRefNum and dirID to FSRef using functions that are not deprecated. 我想知道是否有一种方法可以使用未弃用的函数从vRefNum和dirID转到FSRef。

I've never used it, but it seems FSResolveNodeID may do what you want. 我从来没有使用它,但似乎FSResolveNodeID可能会做你想要的。 Apple pretty much scrubbed its ADC site clean of everything Carbon so I can't find a link to it. 苹果几乎擦洗了它的ADC网站干净的所有碳,所以我找不到它的链接。 But you can look it up in Files.h . 但是你可以在Files.h查找它。 Also, it's only available in 10.5 or later. 此外,它仅在10.5或更高版本中可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM