here is a simple addition to xbmcvfs python module, checks for file or folder existence. needed on external python builds and smb://, among others
added: xbmcvfs.exists(path), check for a file or folder existence, mi…
…mics Pythons os.path.exists()
same comment as last time - we should mimic stdio. however, we can change that later so no objections on this going in for now.
Merged pull request #71 from pipelka/pvr-recordingslist-fix.
pvr: fix recordings list. display recordings if there are subdirectories
Hmm it return just "1". Should be true? Also one question: Why return string? I guess better return "True" for python.
Are you sure that this line returns "1"? Because the code says if the parameter passed to vfs_exists() is not a valid python string/unicode object it will return NULL which will probably end in an exception being thrown.
Yea I test it one of my add-on like this: print 'exsist: %s' % xbmcvfs.exists(xbmc.translatePath(cachedir))
and it print to log this: NOTICE: exsist: 1
Maybe I am on wrong line but something return "1".
Same here, maybe you can consider return "False" instead string "false"
This line doesn't return anything either. It just stores the result of the actual Exists() call in bResult. The generation of the actual python object that will be returned happens on line 203 (4 lines further down).
Sorry I don't know actually. But you get the point right?
line 202 returns bool bResult to the addon(True/False) and is constructed as bool
According to the Python API for Py_BuildValue (see http://docs.python.org/c-api/arg.html#Py_BuildValue) the "b" in Py_BuildValue actually does not result in a boolean (True/False) but in an integer (from a character). Doesn't look like Py_BuildValue() has a way of returning the python objects True or False. That would have to be done using something like
ok, fair ...
print "doesnt exist"
would still work
How is that possible?
print xbmcvfs.exists(xbmc.translatePath(cachedir)) return integer (1/0) not a boolean (True/False)
I use it that way and it works
it works, try it ...
Confirmed. You are right it's working. Sorry for disturbed you guys.