Skip to content

Instantly share code, notes, and snippets.

@sh-zam
Created September 21, 2020 13:12
Show Gist options
  • Save sh-zam/99035a6ec981347212fe1192cb5229f1 to your computer and use it in GitHub Desktop.
Save sh-zam/99035a6ec981347212fe1192cb5229f1 to your computer and use it in GitHub Desktop.

QFileInfo::fileName()

fileName()

suffix()/completeSuffix()

baseName()

These methods usually find parse the filename (full path). But for Android, we can’t do that for all cases, so if the file starts with content:// the Uri is first opened and then queried for filename. Then that fileName is used for all operations

QUrl::fileName()

Once again, we do the same thing with content://, we call QFileInfo::fileName

QUrl::fromLocalFile()

Not sure if it a hack or not, if the file is a content Url we return it as such.

QUrl::toLocalFile()

If it is a Unix local file Url that is something like: file:/data/data/org.krta/files/, we use the same logic as for the default QUrl::toLocalFile(), if not, we return it unmodified.

QUrl::isLocalFile()

returns true.

AndroidContentFileEngine::isRelativePath()

content:// Uris are not treated as relative path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment