Jump to content




better symlink support in CC


12 replies to this topic

#1 electrodude512

  • Members
  • 167 posts
  • LocationEastern USA

Posted 04 June 2013 - 04: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.

#2 TomyLobo

  • Members
  • 42 posts

Posted 04 June 2013 - 04: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.

#3 Sora Firestorm

  • Members
  • 89 posts

Posted 04 June 2013 - 06: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)

#4 GopherAtl

  • Members
  • 888 posts

Posted 04 June 2013 - 07: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.

#5 Sora Firestorm

  • Members
  • 89 posts

Posted 04 June 2013 - 07: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.

#6 electrodude512

  • Members
  • 167 posts
  • LocationEastern USA

Posted 04 June 2013 - 07: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.

#7 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 04 June 2013 - 08:13 PM

This doesn't really make any sense to add.

#8 electrodude512

  • Members
  • 167 posts
  • LocationEastern USA

Posted 04 June 2013 - 09: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?

#9 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 04 June 2013 - 09:38 PM

The bios prints the os.version() return, I believe.

#10 electrodude512

  • Members
  • 167 posts
  • LocationEastern USA

Posted 19 August 2013 - 03: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!

#11 ElvishJerricco

  • Members
  • 803 posts

Posted 19 August 2013 - 05: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.

#12 electrodude512

  • Members
  • 167 posts
  • LocationEastern USA

Posted 19 August 2013 - 06:39 PM

View PostElvishJerricco, on 19 August 2013 - 05:12 PM, said:

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.

#13 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 19 August 2013 - 07: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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users