How to do this?

How would I achieve similar functionaly to packages using the filesystem with vscode and rojo?

What I’m trying to do:

So I have 2 kinds of scripts

  • ones that are specific to that project
  • ones that are not specific to that project

I have a folder with all the scripts that are not subject to that game (utilities, services, etc) I want to be able to edit them and use them in multiple games without making a copy and putting it in the project folder.

My idea:

Keep the “shared” folder outside of game project folders and access it from the project.json file in each project folder.

The problem is how do I access the path outside of the project folder?
image
As you can see src/ is directly under the project folder and the first element in the path.

If anyone knows how I can do it please let me know,

I could probably make the “shared” folder it’s own rojo project and then use packages to update it in each game, but that will annoying and I would like to avoid that

Just move the shared folder outside of the /game/ folder

This is what my .project.json file looks like, as well as the general file structure that I use:

In your case, Common's path for me would be src/Client/SharedClient

	"tree": {
		"$className": "DataModel",

		"HttpService": {
			"$className": "HttpService",
			"$properties": {
				"HttpEnabled": true
			}
		},
		
		"ReplicatedFirst":{
			"$className": "ReplicatedFirst",
			"FirstPackage": {
				"$path": "src/Client/.FirstPackage"
			}
		},
		"ReplicatedStorage":{
			"$className": "ReplicatedStorage",
			"Assets": {
				"$path": "src/Client/Assets"
			},
			"Cache": {
				"$path": "src/Client/.Cache"
			},
			"SharedClient": {
				"$path": "src/Client/SharedClient"
			},
			"ClientPackage": {
				"$path": "src/Client/MainClient"
			}
		},
		"ServerScriptService":{
			"$className": "ServerScriptService",
			"Assets": {
				"$path": "src/Server/Assets"
			},
			"SharedServer": {
				"$path": "src/Server/SharedServer"
			},
			"ServerPackage": {
				"$path": "src/Server/MainServer"
			}
		},
		"StarterGui":{
			"$className": "StarterGui",
			"$ignoreUnknownInstances": true,
			"SharedLocal": {
				"$path": "src/Client/SharedLocal"
			},
			"LocalPackage": {
				"$path": "src/Client/MainLocal"
			}
		}
	}

image

Note that src/Client and src/Server are NOT ReplicatedStorage and ServerScriptService, they’re just organized that way so I can easily navigate to my backend/frondend scripts and have more control over what-goes-where

I’m confused. if I move shared folder out of the project folder how do I reference it in the json file?

Is there a way to move backwards in the directory or something?

image
This is what the directory looks like, I want to move “shared” to “projects”, then from any project (like example game reference projects/shared)

If you want your shared folder univerally accessible across multiple vscode projects, then I’m unsure about that, my apologies

Maybe open an issue on rojo’s GitHub repo?

1 Like

I think I just figured it out this second.

This is the answer
image

The “…/” indicates to go up one in the directory and the “/shared” is to go down to the shared folder. It’s basically like doing script.Parent.otherscript.

Ty for your help anyway

1 Like