Skip to main content
November 5, 2009
解決済み

How can we get the file path of the current document?

  • November 5, 2009
  • 返信数 1.
  • 11414 ビュー

Hi,

     I want to store the current document file path into a string, I tried the  AIDocumentSuite, and 

AIAPI AIErr(* AIDocumentSuite::GetDocumentFileSpecification)(ai::FilePath &file) .

Its ended in prameter conversion error (c 2664). Can anyone guide me to get the current file path.

Thanks in advance

Sreejesh K V

このトピックへの返信は締め切られました。
解決に役立った回答 A. Patterson

ai::FilePath file;

AIErr error = sDocument->GetDocumentFileSpecification(file);

if (error != kNoError) {

  // there was a problem
}

返信数 1

A. Patterson
Inspiring
November 5, 2009

That sounds like the right call -- is the file unsaved? It might not have a file specification if its unsaved.

And as a tip: the error code can be decoded, though it doesn't always result in something useful. If you view it as hex and take each pair of digits (four pairs in all) and cast them to char, you'll spell out a four character code. It often indicates something more specific for an error than 'something went wrong'. If you look at the top of some headers, you'll see #defines for error codes like 'parm' or 't!nf'.

November 6, 2009

Hi,

     Now i am having problem with initialization of the "&file" in the GetDocumentFileSpecification();

AIAPI AIErr (*GetDocumentFileSpecification) ( ai::FilePath &file );

I searched in the samples provided with the SDK and i couldn't find the example for GetDocumentFileSpecification();

Can you give me some snippets regarding the  GetDocumentFileSpecification();

A. Patterson
A. Patterson解決!
Inspiring
November 6, 2009

ai::FilePath file;

AIErr error = sDocument->GetDocumentFileSpecification(file);

if (error != kNoError) {

  // there was a problem
}