Advertisement
Guest User

Untitled

a guest
Dec 24th, 2023
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 2.68 KB | Source Code | 0 0
  1. 'use strict';
  2.  
  3. //=============================================================================
  4. // EISChangeSavePath.js
  5. //=============================================================================
  6.  
  7. /*:
  8. * @author Kino
  9. * @plugindesc Changes the default save path in RPGMakerMV <ChngSvPath>
  10. *
  11. * @param Use MV Directory
  12. * @desc Use MV default directory
  13. * @type boolean
  14. * @default false
  15. *
  16. * @param Save Path
  17. * @desc This will be placed in the users home directory; make sure it ends with '/'
  18. * @default /MyGameName/save/
  19. *
  20. * @help
  21. * Version 1.00
  22. //=============================================================================
  23. //  Introduction
  24. //=============================================================================
  25. *
  26. * This plugin allows you to place your game in a folder seperate from the game
  27. * launch directory on desktop. This means that the user's game data will be
  28. * stored seperately in a folder within the home directory.
  29. * Here are a few examples.
  30. * Linux & Mac : /home/myusrname/MyGameName/save/
  31. * Windows: C:/Users/MyUserName/MyGameName/save/
  32. *
  33. * With the above you have a lot of options on where to save your game data.
  34. * You can also set it use MV directory to on for testing purposes.
  35. *
  36. * This plugin is DESKTOP ONLY. This will not work on browser.
  37. *
  38. *
  39. //=============================================================================
  40. //  Contact Information
  41. //=============================================================================
  42. *
  43. * Contact me via twitter: EISKino, or on the rpg maker forums.
  44. * Username on forums: Kino.
  45. *
  46. * Forum Link: http://forums.rpgmakerweb.com/index.php?/profile/75879-kino/
  47. * Website Link: http://endlessillusoft.com/
  48. * Twitter Link: https://twitter.com/EISKino
  49. * Patreon Link: https://www.patreon.com/EISKino
  50. *
  51. * Hope this plugin helps, and enjoy!
  52. * --Kino
  53. */
  54.  
  55. (function () {
  56.   var params = $plugins.filter((function (plugin) {
  57.     return (/<ChngSvPath>/ig.test(plugin.description)
  58.     );
  59.   }))[0].parameters;
  60.   var ChangePathParams = {
  61.     useDefault: /true/ig.test(params['Use MV Directory'].trim()),
  62.     path: params['Save Path'].trim()
  63.   };
  64.   function setup() {
  65.     //=============================================================================
  66.     //  StorageManager
  67.     //=============================================================================
  68.     StorageManager.localFileDirectoryPath = function () {
  69.       var path = require('path');
  70.       var base = path.dirname(process.mainModule.filename);
  71.       var home = require('os').homedir();
  72.  
  73.       if (ChangePathParams.useDefault) return path.join(base, ChangePathParams.path);else return path.join(home, ChangePathParams.path);
  74.     };
  75.   }
  76.  
  77.   setup();
  78. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement