none wrote:
Christian Biesinger wrote:

@(none) wrote:

nsCOMPtr<nsIFile> profileDir(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
rv = profileDir->InitWithPath(nsDependentCString("/home/adele"));


and got
no matching function for call to `nsDerivedSafe<nsIFile>::
   InitWithNativePath(nsDependentCString)'



You'd need nsILocalFile for that, not nsIFile.
Also, NS_LITERAL_CSTRING is preferred to nsDependentCString for literal strings; and InitWithPath takes a unicode string, so you'd need NS_LITERAL_STRING (note missing C).


However, as you're in C++, you have this nice helper method:
nsCOMPtr<nsILocalFile> result;
nsresult rv = NS_NewLocalFile(NS_LITERAL_STRING("/home/adele", PR_TRUE, getter_AddRefs(result));
if (NS_FAILED(rv)) {
// error handling
}



I tried this code and got the following errors: macro "NS_LITERAL_STRING" passed 3 arguments, but takes just 1 `NS_LITERAL_STRING' undeclared (first use this function)

Do I miss any header files?

Adele

I missed a ')'.

Adele

_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to