Comments (8)
Seems to me its showing all mount points. This is not at all intended, most likely code needs to be done to just show only removable and fixed media.
from jaya.
Seems to me its showing all mount points. This is not at all intended, most likely code needs to be done to just show only removable and fixed media.
Okay, glad to hear it's at least clear to you what the problem is...I wouldn't have had the slightest clue, lol
from jaya.
Decided to experiment with fixing this. In Jaya.Provider.FileSystem/Services/FileSystemService.cs
, replacing the GetDirectoryAsync
function with the following:
public override async Task<DirectoryModel> GetDirectoryAsync(AccountModelBase account, DirectoryModel directory = null)
{
var model = GetFromCache(account, directory);
if (model != null)
return model;
return await Task.Run(() =>
{
model = new DirectoryModel();
if (string.IsNullOrEmpty(directory.Path))
{
model.Directories = new List<DirectoryModel>();
if (ServiceLocator.Instance.GetService<IPlatformService>().GetPlatform() == OSPlatform.Linux)
{
try
{
foreach (var driveInfo in DriveInfo.GetDrives())
{
if (!driveInfo.IsReady)
continue;
if (driveInfo.Name.Equals("/", StringComparison.OrdinalIgnoreCase))
{
var rootDir = new DirectoryModel();
rootDir.Name = driveInfo.Name;
rootDir.Path = driveInfo.RootDirectory.FullName;
rootDir = GetDirectoryAsync(account, rootDir).Result;
model.Directories = rootDir.Directories;
model.Files = rootDir.Files;
break;
}
}
}
catch (UnauthorizedAccessException)
{
}
}
else
{
foreach (var driveInfo in DriveInfo.GetDrives())
{
if (!driveInfo.IsReady)
continue;
var drive = new DirectoryModel(true);
drive.Name = driveInfo.Name;
drive.Path = driveInfo.RootDirectory.FullName;
drive.Size = driveInfo.TotalSize;
model.Directories.Add(drive);
}
}
AddToCache(account, model);
return model;
}
DirectoryInfo info = new DirectoryInfo(directory.Path);
model.Name = info.Name;
model.Path = info.FullName;
model.Created = info.CreationTime;
model.Modified = info.LastWriteTime;
model.Accessed = info.LastAccessTime;
model.IsHidden = info.Attributes.HasFlag(FileAttributes.Hidden);
model.IsSystem = info.Attributes.HasFlag(FileAttributes.System);
model.Files = new List<FileModel>();
try
{
foreach (var fileInfo in info.GetFiles())
{
var file = new FileModel();
if (string.IsNullOrEmpty(fileInfo.Extension))
file.Name = fileInfo.Name;
else
{
file.Name = fileInfo.Name.Replace(fileInfo.Extension, string.Empty);
file.Extension = fileInfo.Extension.Substring(1).ToLowerInvariant();
}
file.Path = fileInfo.FullName;
file.Size = fileInfo.Length;
file.Created = fileInfo.CreationTime;
file.Modified = fileInfo.LastWriteTime;
file.Accessed = fileInfo.LastAccessTime;
file.IsHidden = fileInfo.Attributes.HasFlag(FileAttributes.Hidden);
file.IsSystem = fileInfo.Attributes.HasFlag(FileAttributes.System);
model.Files.Add(file);
}
}
catch (UnauthorizedAccessException)
{
}
model.Directories = new List<DirectoryModel>();
try
{
foreach (var directoryInfo in info.GetDirectories())
{
var dir = new DirectoryModel();
dir.Name = directoryInfo.Name;
dir.Path = directoryInfo.FullName;
dir.Created = directoryInfo.CreationTime;
dir.Modified = directoryInfo.LastWriteTime;
dir.Accessed = directoryInfo.LastAccessTime;
dir.IsHidden = directoryInfo.Attributes.HasFlag(FileAttributes.Hidden);
dir.IsSystem = directoryInfo.Attributes.HasFlag(FileAttributes.System);
model.Directories.Add(dir);
}
}
catch (UnauthorizedAccessException)
{
}
AddToCache(account, model);
return model;
});
}
Seems to produce more desirable results. Is this an acceptable solution?
from jaya.
It should be acceptable if you have tested it with Windows and Mac. If this piece works there without any issues then it should be no problem at all.
from jaya.
It should be acceptable if you have tested it with Windows and Mac. If this piece works there without any issues then it should be no problem at all.
Just tested and can verify that it works without a hitch on Windows. Unfortunately, I have no means of testing on macOS...didn't you say you'd picked up an old macbook or something not too long ago?
from jaya.
I picked up a new MacMini 2014 model in July. Will test it on that. Please add your code and push it to the repository since you have access.
from jaya.
I picked up a new MacMini 2014 model in July. Will test it on that. Please add your code and push it to the repository since you have access.
Okay, done. Looking forward to those test results.
from jaya.
We are rewriting old codebase, this issue is no more relevant.
from jaya.
Related Issues (20)
- WASM Support HOT 1
- Make the dev branch the default
- It would be great ... HOT 7
- Display proper file icons
- Include current directory name in window title HOT 2
- Implement ViewModel Locator
- User-driven skinning HOT 3
- Allow disabling default storage sources HOT 6
- Allow multiple windows HOT 2
- Add favorites list
- Three potential tiers of customization/personalization HOT 3
- Rethink Toolbars/Menu bar organization HOT 3
- Command bar UI HOT 2
- Need to skip unsupported drives in FileSystemService.cs HOT 2
- i can't find release file HOT 1
- Add one drive support HOT 3
- Wiki regarding build HOT 1
- 'Ribbon.OnPropertyChanged(AvaloniaPropertyChangedEventArgs)': no suitable method found to override HOT 14
- Unhandled exception. System.InvalidOperationException: The Style already has a parent. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jaya.