Delete index content if no longer in VFS
This commit is contained in:
parent
fdd741d5fc
commit
8ef60c81e9
2 changed files with 4 additions and 4 deletions
|
@ -158,7 +158,7 @@ impl Index {
|
|||
while let sqlite::State::Row = select.next().unwrap() {
|
||||
let path_string : String = select.read(0).unwrap();
|
||||
let path = Path::new(path_string.as_str());
|
||||
if !path.exists() {
|
||||
if !path.exists() || self.vfs.real_to_virtual(path).is_err() {
|
||||
delete.reset().ok();
|
||||
delete.bind(1, &sqlite::Value::String(path_string.to_owned())).ok();
|
||||
delete.next().ok();
|
||||
|
@ -167,12 +167,12 @@ impl Index {
|
|||
}
|
||||
|
||||
{
|
||||
let mut select = db.prepare("SELECT path FROM songs").unwrap();
|
||||
let mut select = db.prepare("SELECT path FROM directories").unwrap();
|
||||
let mut delete = db.prepare("DELETE FROM directories WHERE path = ?").unwrap();
|
||||
while let sqlite::State::Row = select.next().unwrap() {
|
||||
let path_string : String = select.read(0).unwrap();
|
||||
let path = Path::new(path_string.as_str());
|
||||
if !path.exists() {
|
||||
if !path.exists() || self.vfs.real_to_virtual(path).is_err() {
|
||||
delete.reset().ok();
|
||||
delete.bind(1, &sqlite::Value::String(path_string.to_owned())).ok();
|
||||
delete.next().ok();
|
||||
|
|
|
@ -93,7 +93,7 @@ fn main() {
|
|||
|
||||
let mut mount = Mount::new();
|
||||
mount.mount("/api/", api_chain);
|
||||
mount.mount("/", Static::new(path::Path::new("web")));
|
||||
mount.mount("/", Static::new(path::Path::new("../polaris-web")));
|
||||
let mut server = Iron::new(mount).http(("0.0.0.0", 5050)).unwrap();
|
||||
|
||||
// Start DDNS updates
|
||||
|
|
Loading…
Add table
Reference in a new issue