fivem icon indicating copy to clipboard operation
fivem copied to clipboard

Feature request: determine name from resource manifest

Open matsn0w opened this issue 2 years ago • 5 comments

Hello there,

I happened to come across a flaw while developing a server resource and I may have a fix for it right away.

Background

I am trying to develop a resource which is dependent on another resource. That's totally possible with a dependency key in my resource manifest, but that is assuming that the name of the dependent resource isn't changed by the server owner.

As far as I know, a resource is given a name based on it's folder (containing fxmanifest.lua).

Because of this, I am not 100% sure that dependency Y is available to resource X. It might be, but with a different name (read: folder path)!

Proposal

My idea for fixing the described issue is by simply adding a name key to the resource manifest spec, specifiying a unique 'resource id' that can be used for identifying this particular resource. This can be useful for things like dependencies and there may be more applications.

What do you think? Am I missing something? Am I thinking too easy?

Let me know!

Cheers, matsn0w

matsn0w avatar Aug 13 '22 19:08 matsn0w

if the server owner changes resource names and it breaks, surely its on them for changing it?

Mycroft-Studios avatar Aug 13 '22 19:08 Mycroft-Studios

They can fix the issue themselves by just "providing" for the other resource name, seems like wasted effort to add a name field when they will likely just change that too and complain about it being broken

provides {
	'mysql-async'
}

AvarianKnight avatar Aug 13 '22 19:08 AvarianKnight

if the server owner changes resource names and it breaks, surely its on them for changing it?

Well, you are definately right. I can totally put a warning in the docs, but... People don't read docs. Maybe we can prevent such issues? Make things foolproof so to say ;)

They can fix the issue themselves by just "providing" for the other resource name, seems like wasted effort to add a name field when they will likely just change that too and complain about it being broken

Yeah, good point. However, changing 'code' is a step further IMO.

matsn0w avatar Aug 13 '22 19:08 matsn0w

They can fix the issue themselves by just "providing" for the other resource name

that does imply a certain level of awareness when a resource name is changed/nonstandard, which most amateurish server owners just don't have imho, many just click the "download as zip" button on GitHub and drag&drop the folders, without actually paying attention to the resource name.

On the flip side, it seems to me that using provide does work, even if the resource is named the exact same. so as a resource developer this may be a thing you'd want to implement by default, quickly testing it on EasyAdmin shows that it still works as intended, although if this is intentional is another thing altogether..

Blumlaut avatar Aug 14 '22 08:08 Blumlaut

They can fix the issue themselves by just "providing" for the other resource name, seems like wasted effort to add a name field when they will likely just change that too and complain about it being broken

provides {
	'mysql-async'
}

I wish this "provides" would also work for exports. So if people are renaming their scripts, and have the original script name in "provides", it will directly link the exports to that renamed script.

That would help people renaming the qb-core scripts and other creators needing to create separate configs for custom script names.

xDope7137 avatar Sep 09 '22 15:09 xDope7137

Closing this issue as stale. If this feature request/RFC needs to be revived the forums would be the place to have it.

The discussion here has been productive.

gottfriedleibniz avatar Feb 06 '24 21:02 gottfriedleibniz