Author Topic: weird behavior with file hardlinks on linux.  (Read 285 times)

Offline vaughnrichardallen

  • Single posting newcomer
  • *
  • Posts: 1
weird behavior with file hardlinks on linux.
« on: November 16, 2020, 01:09:17 pm »
I have noticed weird behavior with using codeblocks to edit source files that are hard links to files in another directory.
You'd expect the original file to be updated after you save, but instead the link is deleted from the directory and replaced with a new file of the same name.
This is going to make having separate IDE project folders for each operating system I compile for more difficult, as I'll have to manually sync the source files that are shared between all systems.
In fact I lost all of my work this weekend because I was not expecting codeblocks to remove the links and replace them with new files and my script automatically adds the links. This caused the files saved in codeblocks to be replaced with links to the original files in the source files directory which were not updated because codeblocks replaced the links with files instead of updating the original files. The new files were not part of the git repo because it was expected to only have one copy of the source files shared between all operating system ide project folders and the file hardlinks were .gitignore'd.
I was expecting to have just one copy of source files (a .h file in the project directory of each system has preprocessor defines to tell source files which system is compiling) and then use the same source files on every system (example, linux, openbsd, windows, etc) and the repo would contain one directory of source files and then a directory for each ide containing the project file and a "os_define.h" file.
Looks like I'll just have to have an entire copy of the sources file in each ide project folder for each OS I compile it on and manually sync everything using git wizardry.
« Last Edit: November 16, 2020, 01:17:43 pm by vaughnrichardallen »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12897
    • Travis build status
Re: weird behavior with file hardlinks on linux.
« Reply #1 on: November 16, 2020, 05:45:07 pm »
Just for reference if someone finds this topic and doesn't find the ticket:
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]