I just trying to get the real path of my private filesystem but I just obtain an empty string if I use:
\Drupal::service('file_system')->realpath("private://");
There one user in Get the public path directory that says that this is the correct way, but this is not working for me.
My private filesystem is configured as:
$settings['file_private_path'] = '/User/adriancid/private-drupal-folder';
If I use file_default_scheme()
I see:
private
temporary://
orpublic://
? Could be that you have not configured the private path in settings.php.\Drupal::service('file_system')->realpath("private://");
works for you?