This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
electrodude512's profile picture

better symlink support in CC

Started by electrodude512, 04 June 2013 - 03:29 PM
electrodude512 #1
Posted 04 June 2013 - 05:29 PM
I use symlinks just about everywhere, from syncing the /rom folders of CC in all my MC instances to redirecting the MC launcher to whatever instance I want to play (Yes I have a shell script for that that I call whichcraft, I don't do it manually) to removing the necessity of my having many identical copies of large files on my computer. I prefer them over aliases (I use osx) because they work everywhere and not just through Finder. It would be very useful if you could create symlinks, have their type be different from the type of whatever they point at, and figure out what they point at, all from lua in CC. Windows also has symlinks (and I'm not confusing symlinks with shortcuts) but they don't tell you that, so this won't create cross-platform problems.
TomyLobo #2
Posted 04 June 2013 - 05:33 PM
i vote for this
currently i'm using a small node.js program and the http api to make symlinks from within CC.

EDIT: wait… i didnt read this properly. your idea is stupid. just make the symlinks yourself.
Sora Firestorm #3
Posted 04 June 2013 - 07:47 PM
You mean from within ComputerCraft itself? You can already implement
it yourself by patching over the appropriate fs functions (for files)
and the appropriate shell functions. (for directories)
Heck, I've even been planning on implementing it. (Haven't had much of
time with Minecraft lately)
GopherAtl #4
Posted 04 June 2013 - 08:27 PM
think he means within cc itself, but allowing linking to things OUTSIDE the computer's directory. If so, then the answer is a pretty resounding "hells no" as this could allow you to access all sorts of files you shouldn't be able to access from within cc.
Sora Firestorm #5
Posted 04 June 2013 - 08:49 PM
Well, here's what I have in reply :
1. if you really want symlinks from CC to the computer, make your own. You've proven you can do it on your own.
2. but there will never be a way to make them within CC. See above for why.
electrodude512 #6
Posted 04 June 2013 - 08:56 PM
No, i only meant inside the computer's directory. I just got carried away about how much I love symlinks…

Better idea: specify where /rom is kept in CC's config file, also have /rom/programs/ccversionnumber/ folders that only get added to your path if it's that version for version specific things. i.e. CC 1.53-only program goes in /rom/programs/1.53/. I could probably write a modification to /rom/startup that does this, in fact, will do that now. It would still be nice for the location of /rom to be configurable for people who don't know how to use symlinks.
Lyqyd #7
Posted 04 June 2013 - 09:13 PM
This doesn't really make any sense to add.
electrodude512 #8
Posted 04 June 2013 - 10:20 PM
I'm almost done the version-specific folder idea, but I realized that os.version() only return "CraftOS 1.5" and not something containing the string "1.5.3". Is there a reason for this? Does it just get the string printed by the bios at the top of the screen?
Lyqyd #9
Posted 04 June 2013 - 10:38 PM
The bios prints the os.version() return, I believe.
electrodude512 #10
Posted 19 August 2013 - 04:52 PM
I found a legit reason to add symlink support, as well as a bug.

I want to be able to mark a program to be autorun parallelly in a coroutine in my OS, and putting symlinks to them in a folder is a standard unix way of doing things like this and in my opinion the best and how I want to do this in my OS. There are many, many other uses for symlinks other than this.

BUG: I renamed a symlink from CC and it replaced my symlink with a empty file! It should have renamed the symlink, not replaced it!
ElvishJerricco #11
Posted 19 August 2013 - 06:12 PM
The problem with just patching the fs api is that then your real computer won't see the file as a symlink. I agree that adding symlinks to CC would be really nice. Obviously you can only link from a spot in the computer's directory to another spot in the computer's directory, but it'd at least be possible in a way that allows your OS to see them.
electrodude512 #12
Posted 19 August 2013 - 07:39 PM
The problem with just patching the fs api is that then your real computer won't see the file as a symlink. I agree that adding symlinks to CC would be really nice. Obviously you can only link from a spot in the computer's directory to another spot in the computer's directory, but it'd at least be possible in a way that allows your OS to see them.

Don't patch the fs api. Fix the mod to understand your computer's filesystem's symlinks. Yes, Windows/NTFS has symlinks, try "mklink /?" in cmd.exe.
Lyqyd #13
Posted 19 August 2013 - 08:01 PM
No.

Allowing the creation of symlinks is especially problematic, and simply won't be added. This is unnecessary. You can emulate the somewhat acceptable version of this suggestion with modifications to fs.