Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

But how do you find the old location? Do you need to build against both libraries, call old_lib.get_path(), check if it exists, then call new_lib.get_path(), copy the files, delete the old dir, them and then read from the new one. What if it's a symlink? What if copying fails mid-way? Does the library or the program handle all of this? Can you even compile against both libraries if one is a fork of the other (namespace issues)?


The app doesn't migrate the files, so no worrying about copying. Don't bother even checking if it's a symlink. A symlink is a file. Just open it and read it.


> But how do you find the old location? Do you need to build against both libraries, call old_lib.get_path(), check if it exists, then call new_lib.get_path() […] Can you even compile against both libraries if one is a fork of the other (namespace issues)?

You are really making this more complicated than it needs to be. Just do it yourself, to be honest. It’s like 3–5 lines of code. Introducing a library just complicates it.

> copy the files, delete the old dir, them and then read from the new one. […] What if copying fails mid-way?

As I said: You don’t need to copy, delete, or move any files. Just support both modern and legacy paths, and let the user take care of the migration, if they choose to.

> What if it's a symlink?

Again, why are you making this so complicated? Just try to read the file. If it fails, check the next location.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: