Update doc + bugfix in same file checking

* README updated
* Use os.path.samepath to test wether filenames strings are the same
instead of direct comparison.
This commit is contained in:
Phyks 2014-05-04 02:45:24 +02:00
parent bd91fa2e49
commit bf1eca4c42
2 changed files with 3 additions and 3 deletions

View File

@ -69,7 +69,7 @@ TODO
### Edit entries ### Edit entries
TODO Run `./main.py edit PARAM` where `PARAM` should be either a path to a paper file or an ident in the bibtex index. This will open a text editor to edit the corresponding bibtex entry.
### Data storage ### Data storage

View File

@ -135,7 +135,7 @@ def deleteFile(filename):
found = False found = False
for key in bibtex.keys(): for key in bibtex.keys():
if bibtex[key]['file'] == filename: if os.path.samepath(bibtex[key]['file'], filename):
found = True found = True
try: try:
os.remove(bibtex[key]['file']) os.remove(bibtex[key]['file'])
@ -204,7 +204,7 @@ def getBibtex(entry, file_id = 'both'):
pass pass
elif file_id == 'both' or file_id == 'file': elif file_id == 'both' or file_id == 'file':
for key in bibtex.keys(): for key in bibtex.keys():
if bibtex[key]['file'] == filename: if os.path.samepath(bibtex[key]['file'], filename):
bibtex_entry = bibtex[key] bibtex_entry = bibtex[key]
break break
return bibtex_entry return bibtex_entry