How can I use a relative path in my toml file? - iphone

I want to use a relative directory in toml file.
I heard that I should use "\" instead of "" in toml file,
but I don't know how to use relative path in toml file.
HatMode = "Custom"
HorizontalSize = 1.5
HatPosition = 0.600000023841858
CustomHatPath = "C:\\Users\\Desktop\\kane_goose\\DesktopGoose_v0.3_Extractor\\Assets\\Mods\\HatGoos\\kane.png"
This is codes inside of toml file.
I should enter a relative path in
CustomHatPath = "C:\\Users\\Desktop\\kane_goose\\DesktopGoose_v0.3_Extractor\\Assets\\Mods\\HatGoos\\kane.png"
this part.
Below, directory of the first image is C:\Users\username\Desktop\kane_goose\DesktopGoose_v0.3_Extractor\Assets\Mods\HatGoos
, and directory of the second image is C:\Users\username\Desktop\kane_goose\DesktopGoose_v0.3_Extractor\Assets\Mods\HatGoos\hat
The toml file is on the first image, and I must add the kane.png of the second image to the toml file.
Can you teach me how to use relative path in this situation? in toml file?

Related

Get-ChildItem path without specifying the full path

So i am trying to get-childItem of a specific path.
my command look like this
(Get-ChildItem -Path fes\.policy -Recurse -Directory -Exclude ".*")
and the fullpath is something like this:
path 'C:\Users\(name)\(folder)\(folder)\(folder)\(folder)\governance\fes\.policy
and it works fine when I stand in the \governance\ folder and run the command. But when i am some where else it just add the parameter \fes.policy and says that the path not exsist
Get-ChildItem: Cannot find path C:\Users\(name)\(folder)\(folder)\(folder)\(folder)\governance\src\Tests\fes\.policy' because it does not exist.
which makes sense, but it just dont know how I get it to go back in directories and then put the \fes.policy on the path.
The start of the path is not always going to be the same, so I cant just put the whole path in.
You need to provide either the Fully-qualified path (the path starting from the drive root starting with C:) or the relative path (the path from the current working directory). From what it sounds like, you are trying to use a relative path, which is useful when the folder structure is only partially guaranteed (e.g. FolderA in the example below will always exist, but it's placement under C: may differ from system to system).
.. is a reserved directory "name" meaning the parent folder, similar to how . is used to represent the current folder. You will need to provide the relative path to the file using .. if you are in a different branch of the directory structure than where fes/.policy is located.
Since I don't know your full directory structure and only what you've provided let's take the following example:
Current directory: C:\Users\username\FolderA\FolderB\FolderC
Target file: C:\Users\username\FolderA\governance\src\Tests\fes\.policy
From FolderC, you should be able to locate the file with Get-ChildItem using the following path:
Note: If any of the path has spaces you will want to wrap them in single or double quotes (the latter if you want to expand variables within the path string), or else escape the spaces with `, though quoting is preferred.
Get-ChildItem ../../governance/src/Tests/fes/.policy
Since .. represents the parent folder of the current directory, ../../ represents two parents up, and would put you in FolderA. From there you know governance/ exists and you can craft the rest of the path as you need.

File Path with the file name as a variable

I have a code that selects a zip folder from a path. My problem is the zip folder name will always be different. The path will always be the same though.
Example: "C\Users\name\Customer\New_Archive_022820186S12.zip"
I would like to make the zip folder as a variable so any zip folder will be picked up regardless of the name. In the example above the folder name is New_Archive_022820186S12.zip
What I'm looking for is a path name where the zip folder in the path is a variable
Suggestions?
Hi in C++ language. Thanks so much
Store the folder path and filename in separate variables, and then you can concatenate them together when needed eg:
std::string folder = "C:\\Users\\name\\Customer\\";
std::string filename = "New_Archive_022820186S12.zip"; // <-- populate as needed...
std::string zipfile = folder + filename;
// use zipfile as needed...

find the path of a file in matlab

Hello I would like to locate the file 'my_file.mat' that should be somewhere inside the folder 'C:\...\mypath\folder1'.
the folder folder1 contains several subfolders and the file my_file could be in any of these subfolders.
I would like to retrieve its full path.
You want to use the which function.
mypath = which('my_file.mat')
As commented below, this assumes that your 'folder1' has been added to your search path. To add (and remove if no longer needed) 'folder1' to your search path:
my_folder_path = 'path/to/folder1'
addpath(genpath(my_folder_path))
mypath = which('my_file.mat')
rmpath(my_folder_path)
I think you are looking for genpath and which combo:
addpath(genpath(folderName));
which test.txt -all
>>
Z:\home\**\Documents\MATLAB\R2010b\bin\test.txt

How to extract .gz file with .txt extension folder?

I'm currently stuck with this problem where my .gz file is "some_name.txt.gz" (the .gz is not visible, but can be recognized with File::Type functions),
and inside the .gz file, there is a FOLDER with the name "some_name.txt", which contains other files and folders.
However, I am not able to extract the archive as you would manually (the folder with the name "some_name.txt" is extracted along with its contents) when calling the extract function from the Archive::Extract because it will just extract the "some_name.txt" folder as a .txt file.
I've been searching the web for answers, but none are correct solutions. Is there a way around this?
From Archive::Extract official doc
"Since .gz files never hold a directory, but only a single file;"
I would recommend using tar on the folder and then gz it.
That way you can use Archive::Tar to easily extract specific file:
Example from official docs:
$tar->extract_file( $file, [$extract_path] )
Write an entry, whose name is equivalent to the file name provided to disk. Optionally takes a second parameter, which is the full native path (including filename) the entry will be written to.
For example:
$tar->extract_file( 'name/in/archive', 'name/i/want/to/give/it' );
$tar->extract_file( $at_file_object, 'name/i/want/to/give/it' );
Returns true on success, false on failure.
Hope this helps.
Maybe you can identify these files with File::Type, rename them with .gz extension instead of .txt, then try Archive::Extract on it?
A gzip file can only contain a single file. If you have an archive file that contains a folder plus multiple other files and folders, then you may have a gzip file that contains a tar file. Alternatively you may have a zip file.
Can you give more details on how the archive file was created and a listing of it contents?

how can I rename a folder using Matlab script

I want to rename a folder in a path by using Matlab script:
c:\My Path\New Folder\ --> c:\MyPath\NewFolder\ %remove the spaces in the path name
got what I wanted finally to work:
system('7z e "C:\Public\test\dry?testing41013\Log?#1\max_logs_can_messages.tgz" -o"C:\Public\test\dry testing41013\Log #1\"')
had to use "?" for spaces in the first path but not the second path
You can use MOVEFILE function. It works for folders as well.
movefile('c:\My Path\New Folder\', 'c:\MyPath\NewFolder')