public void FromFsPathTest() { string fsPath1 = @"C:\Test\Test1"; string fsPath2 = @"Test\Test2\Test3"; string fsPath3 = @"Test\Test2\Module.lua"; string fsPath4 = @"Test\Test3\Module.mod.lua"; Assert.AreEqual("Test.Test1", RobloxPathHelper.FromFsPath(fsPath1)); Assert.AreEqual("Test.Test2.Test3", RobloxPathHelper.FromFsPath(fsPath2)); Assert.AreEqual("Test.Test2.Module", RobloxPathHelper.FromFsPath(fsPath3)); Assert.AreEqual("Test.Test3.Module", RobloxPathHelper.FromFsPath(fsPath4)); }
public static Script FromFileSystem(string filePath, Mapping mapping) { string info = Path.GetFileNameWithoutExtension(filePath); string name = Path.GetFileNameWithoutExtension(info); string typeString = Path.GetExtension(info); string relativeFsPath = PathExtension.MakeRelativePath(mapping.FsPath, filePath); string relativeRbxPath = RobloxPathHelper.FromFsPath(relativeFsPath); string rbxPath = RobloxPathHelper.Join(mapping.RobloxPath, relativeRbxPath); Script script = new Script(); script.RobloxPath = rbxPath; script.FilePath = filePath; script.Name = name; script.Type = GetScriptType(typeString); return(script); }