Menu

#1033 Codeblocks replaces file hardlinks with a new file

Undefined
fixed
nobody
None
Bug_Report
2020-11-17
2020-11-16
No

When you have your codeblocks project including source files that are hardlinks to files in another directory, codeblocks will delete the hardlink file and replace it with a new file of the same name everytime you save which causes saves not to be written to the original file. Users have to manually copy the updated file back to the source directory, then recreate the hardlink.
The expected behavior is to overwrite the file that is linked, not to delete the file entry from the directory and create a brand new file every time you save.
I have a project that is cross platform, and each platform has a separate project folder but they all share the same source files located in a folder. The hard links to all of the source files are intended to keep each platform in sync so that compiling for each platform is simple because they all share the same source files. The only different is a "os_define.h" located in the root of each project folder for each platform.
I suppose I'll have to just create seperate copies of the entire source files folder and use git to keep them synced. I was hoping to keep everything simple.

Discussion

  • Teodor Petrov

    Teodor Petrov - 2020-11-16
    • labels: file links -->
    • status: open --> fixed
    • Milestone: Release_xx.yy --> Undefined
     
  • Teodor Petrov

    Teodor Petrov - 2020-11-16

    There is an option to disable this behaviour: Settings -> Environment -> General settings -> Save using "save to temp and rename" operation.

    Generally what you're doing is wrong and sooner or later you'll regret that you're not using git/svn/etc :)

     
  • richard vaughn

    richard vaughn - 2020-11-17

    I am using git. I had one big directory which was the base of the git repo and the source files were all in a directory in that one. Then there was a directory in the base directory for each platform+ide, and inside of those were a directory containing links to the files in the source directory in the base directory. So each ide project folder has it's own "os_define.h" that changes between platforms.

    Just out of curiosity, what method would you recommend to accomplish the same thing in a manner more consistent with how its normally done in the wild? I'm only a hobbyist and I just make stuff up as I go along mostly.

     

    Last edit: richard vaughn 2020-11-17
  • Teodor Petrov

    Teodor Petrov - 2020-11-17

    No idea why you want to use hard-links in this case, but it is up to you. Set the option and you can continue to suffer. :)

     
    • richard vaughn

      richard vaughn - 2020-11-17

      Nah, I have a bash script that fixes all of the links, so you would run it on each new machine that you cloned the repo onto to populate the ide project's local source directory.
      I just added a few rsync's to preserve newer source files before they get clobbered.
      The files inside of the IDE's copy of the source files directory are ".gitignore"'d. I figured out something was terribly wrong when I erased the local copy of the repo and then recloned it from a server copy and got old files.

       

      Last edit: richard vaughn 2020-11-17

Log in to post a comment.