Jump to content

'GetAllResources' method throws error


Recommended Posts

Hi there, I'm new here on RageMP development, so I'm not sure if it's a newbie thing or not lol but well, I will ask. I have a problem while using the method "NAPI.Resource.GetAllResources()" from a C# script. The error is the following:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\user\Documents\Rage MP\Servidor\resources'.
   at void System.IO.Win32FileSystemEnumerableIterator<TSource>.HandleError(int errorCode, string path)
   at void System.IO.Win32FileSystemEnumerableIterator<TSource>.CommonInit()
   at new System.IO.Win32FileSystemEnumerableIterator<TSource>(string path, string originalUserPath, string searchPattern, SearchOption searchOption, SearchResultHandler<TSource> resultHandler)
   at IEnumerable<string> System.IO.Win32FileSystemEnumerableFactory.CreateFileNameIterator(string path, string originalUserPath, string searchPattern, bool includeFiles, bool includeDirs, SearchOption searchOption)
   at IEnumerable<string> System.IO.Win32FileSystem.EnumeratePaths(string fullPath, string searchPattern, SearchOption searchOption, SearchTarget searchTarget)
   at string[] System.IO.Directory.InternalGetFileDirectoryNames(string path, string userPathOriginal, string searchPattern, bool includeFiles, bool includeDirs, SearchOption searchOption)
   at string[] System.IO.Directory.GetDirectories(string path)
   at string[] GTANetworkMethods.Resource.GetAllResources()
   at void sgo_base.SGOBase.resources(Client player) in C:\Users\user\Documents\Rage MP\Servidor\bridge\resources\ragemp_resources\sgo_base\SGOBase.cs:line 9
   --- End of inner exception stack trace ---
   at object RuntimeMethodHandle.InvokeMethod(object target, object[] arguments, Signature sig, bool constructor)
   at object System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(object obj, object[] parameters, object[] arguments)
   at bool GTANetworkInternals.CommandParser.Parse(Client sender, string cmdRaw, string ourcmd, string[] args)

As you can see, it says that the directory "resources" at the server folder doesn't exist (it means, the server ROOT folder, which must be wrong ???). Can I change the path somewhere or I am doing something wrong? Shouldn't be the folder path equals to "C:\Users\user\Documents\Rage MP\Servidor\bridge\resources"?

If you need more info tell me! Thx so much in advance

Link to comment
Share on other sites

  • 5 months later...

For people having the same issue, i ran into this one aswell and a fix for me was using the GetRunningResources() instead, that seems to work atleast with resources that are being ran on the server already, for my case it was for a global resource restart so it works like a charm :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...