Hi Team!
I’m using Aspose.Imaging to convert vector graphical images to raster image. I noticed that during the conversions temporary files are created on /tmp/Aspose.Imaging/ directory. In my use case my application sould not access the /tmp directory.
I saw that there is a Aspose.Imaging.Cache class where I can customize the CacheFolder. I set the CacheFolder to my custom directory but it seems like it doesn’t have any effect, temp files are still created in the /tmp.
I used fatrace to monitor filesystem access. The command: sudo fatrace -t | grep '/tmp/Aspose' > fatrace.log
My questions:
How can I prevent Aspose.Imaging library to accessing the /tmp directory?
My other question what will happens with the file conversion if my application doesn’t have rights to access the /tmp dir?
To prevent the Aspose.Imaging library from accessing the /tmp directory and to set a custom cache folder, you can utilize the Cache.CacheFolder property. However, it seems that you are experiencing issues where the temporary files are still being created in the /tmp directory despite setting this property.
Here are some steps you can take to address your concerns:
Setting the Cache Folder: Ensure that you are setting the Cache.CacheFolder property correctly in your code before any image processing occurs. Here’s an example of how to set it:
// Set the custom cache folder
Cache.setCacheFolder("path/to/your/custom/directory");
Make sure that the specified directory exists and that your application has the necessary permissions to write to it.
Environment Variable: In addition to setting the cache folder in your code, you can also set the TEMP environment variable before running your application. This can be done in your terminal as follows:
export TEMP=/path/to/your/custom/directory
This approach may help redirect the temporary file creation to your specified directory.
Permissions: If your application does not have rights to access the /tmp directory, it may lead to exceptions or failures during file conversion. It is crucial to ensure that your application has the necessary permissions to access the directory you are using for caching.
Monitoring File Access: Since you are already using fatrace to monitor filesystem access, continue to check the logs after making the above changes to confirm that the temporary files are being created in the desired location.
If the issue persists, it may be beneficial to reach out to Aspose support for further assistance, as there might be an underlying issue with the library’s handling of the cache folder settings.
For more information on managing cache settings in Aspose.Imaging, you can refer to the official documentation or community discussions related to this topic.
Cache.CacheFolder is a folder for storing the file stream cache. Other Aspose temporary files are stored in the directory specified in the environment variable TEMP.
As a result, the only option available to you for solving the problem is to modify the environment variable.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.