Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions developer_manual/basics/storage/filesystem.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,13 @@ All methods return a Folder object on which files and folders can be accessed, o
try {
try {
$file = $userFolder->get('myfile.txt');

// the id can be accessed by $file->getId();
$file->putContent($content);
} catch(\OCP\Files\NotFoundException $e) {
$userFolder->touch('myfile.txt');
$file = $userFolder->get('myfile.txt');
$userFolder->newFile('myfile.txt', $content);
}

// the id can be accessed by $file->getId();
$file->putContent($content);

} catch(\OCP\Files\NotPermittedException $e) {
// you have to create this exception by yourself ;)
throw new StorageException('Cant write to file');
Expand Down Expand Up @@ -163,4 +162,4 @@ The recommended way of adding your own mounts to the filesystem from an app is i
and registering the provider using ``OCP\Files\Config\IMountProviderCollection::registerProvider``.

Once registered, your provider will be called every time the filesystem is being setup for a user and your mount provider
can return a list of mounts to add for that user.
can return a list of mounts to add for that user.