Skip to content

Commit

Permalink
Fix MikTeX resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
efoerster committed Jun 9, 2019
1 parent 923f992 commit 5ff1161
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ use futures::lock::Mutex;
use futures::prelude::*;
use jsonrpc::MessageHandler;
use std::sync::Arc;
use stderrlog::{ColorChoice, Timestamp};
use texlab::client::LatexLspClient;
use texlab::codec::LspCodec;
use texlab::server::LatexLspServer;
use tokio::codec::FramedRead;
use tokio_codec::FramedWrite;
use tokio_stdin_stdout;
use stderrlog::{Timestamp, ColorChoice};

fn main() {
let matches = app_from_crate!()
Expand Down
9 changes: 2 additions & 7 deletions src/resolver/miktex.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use super::{Error, Result};
use byteorder::{LittleEndian, ReadBytesExt};
use lazy_static::lazy_static;
use regex::Regex;
use std::ffi::OsStr;
use std::fs;
use std::io;
use std::io::Cursor;
Expand All @@ -14,10 +13,6 @@ const FNDB_TABLE_POINTER_OFFSET: usize = 4 * FNDB_WORD_SIZE;
const FNDB_TABLE_SIZE_OFFSET: usize = 6 * FNDB_WORD_SIZE;
const FNDB_ENTRY_SIZE: usize = 4 * FNDB_WORD_SIZE;

lazy_static! {
static ref FNDB_REGEX: Regex = Regex::new(r#".*\.fndb-\d+"#).unwrap();
}

pub fn read_database(directory: &Path, root_directories: &[PathBuf]) -> Result<Vec<PathBuf>> {
let database_directory = directory.join(DATABASE_PATH);
if !database_directory.exists() {
Expand All @@ -28,7 +23,7 @@ pub fn read_database(directory: &Path, root_directories: &[PathBuf]) -> Result<V
let files = fs::read_dir(database_directory)
.expect("Could not traverse database directory")
.filter_map(|x| x.ok())
.filter(|x| FNDB_REGEX.is_match(x.file_name().to_str().unwrap()));
.filter(|x| x.path().extension().and_then(OsStr::to_str) == Some("fndb-5"));

for file in files {
let bytes = fs::read(file.path()).expect("Could not read fndb file");
Expand Down

0 comments on commit 5ff1161

Please sign in to comment.