Check if file exists in mounted folder Webdev

Hi all,

I feel like I'm going crazy with this, but I can't seem to check whether a file exists in a mounted folder in Webdev.

I've tried the following:

  • Creating a httpClient and sending a HEAD request to the URL of the file
httpClient = system.net.httpClient()

def checkIfNetworkFileExists(path):
	global httpClient
	response = httpClient.head(path)
	return response.getStatusCode()

=> This gives me a status code 405 "Method not allowed", although I can get the file normally using a GET method.

  • Using the system.file.fileExists function and supplying the URL of my file
    => Returns false although the path is correct

  • Using a mesage handler to the gateway, and the gateway then calls system.file.fileExists
    => Returns false as well

The only thing that works is supplying the absolute path to the system.file.fileExists in a message handler to the gateway, but I really want to avoid using this, and instead use the URL if possible...

What am I missing ?

Thanks

Sounds like you need to make a feature request (on the ideas site) for Ignition to implement the HEAD method on mounted folders.

Or, perhaps, not use mounted folders. Implement HEAD and GET for that folder via python WebDev resources.

3 Likes

Thanks Phil, I'll look into it.

The mounted folder is a client requirement on this project unfortunately.

In the meantime, I resorted to an absolute path for the moment.