Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

how to delete a file using inDesign Sdk

New Here ,
Dec 03, 2019 Dec 03, 2019

I have used the below code, but it is not working:

 

IDFile file;
FileUtils::GetAppLocalCachedDataFolder(&file,"InDesign Recovery");

file.Delete();

Someone help me out!

TOPICS
SDK
328
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 03, 2019 Dec 03, 2019

The delete method delete an empty directory, are you sure the directory is empty. I am quoting the method header below for your reference

	/**
	 Deletes the file or directory from the file system. \\
	 If a directory, it must be empty (contain no files or folders).
	 To delete a non-empty directory, call CoreFileUtils::DeleteDirectory().
	 @return True if successfully deleted, else false.
	 */

 

-Manan 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 03, 2019 Dec 03, 2019

not able to delete a file in folder

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 03, 2019 Dec 03, 2019

If you need to delete a file in this folder then you are still doing it wrong, the call to the GetAppLocalCachedDataFolder would find the InDesign Recovery folder inside the LocalCache folder and if it is not present it will create it. So if your file is present inside the InDesign Recovery folder you need to add the path to that file to the IDFile you send as an argument to GetAppLocalCachedDataFolder

I think the AppendName method should work, you can look into the AFile.h header file for functions that will allow you to append the path component till the file you want to delete to the folder IDFile you have.

 

-Manan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 03, 2019 Dec 03, 2019
LATEST

thanks it works

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines