Raised This Month: $12 Target: $400
 3% 

http://amxmodx.org/api/file/__functions Where's symlink?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 05-24-2022 , 17:10   http://amxmodx.org/api/file/__functions Where's symlink?
Reply With Quote #1

I see how to destroy files with, unlink, but nothing on making a symbolic link nor copying a file. Workaround is to make the file from scratch and then save it. Is that the only way via Amxx currently?
__________________
DJEarthQuake is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 05-25-2022 , 12:42   Re: http://amxmodx.org/api/file/__functions Where's symlink?
Reply With Quote #2

A symlink is not a copy of a file. A symlink is just an entry inside the filesystem that points to the metadata(and indirectly to the data) of the original file. The purpose of a symlink is to be able to refer to the same file from multiple folders.
A symlink is an inode(a structure used to store metadata about files). The symlink data is the path to the actual file, which gets resolved every time you access the symlink. Changing the symlink changes the actual file, there is no copy created.

unlink is the same thing as delete_file. Contrary to popular belief, unlink and delete_file do not actually delete a file. They delete a dentry/directory entry(a structure that contains the file's name and a pointer/link to the inode of that file). Once all the dentry structures linking to a file are removed by unlink, then the file metadata and data are removed from the disk.

In order to create a copy of a file, you have to do it manually. Either read it line by line, or you can use the fread*/fwrite* natives to deal with the file as if it was a binary file(it doesn't have to be).
__________________

Last edited by HamletEagle; 05-25-2022 at 12:42.
HamletEagle is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 05-26-2022 , 10:59   Re: http://amxmodx.org/api/file/__functions Where's symlink?
Reply With Quote #3

Thanks for confirming manually is all we have currently. Well aware of what a symbolic link is. Having unlink without link, what is the purpose of that please?
__________________
DJEarthQuake is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 05-26-2022 , 14:54   Re: http://amxmodx.org/api/file/__functions Where's symlink?
Reply With Quote #4

Quote:
Originally Posted by DJEarthQuake View Post
Thanks for confirming manually is all we have currently. Well aware of what a symbolic link is. Having unlink without link, what is the purpose of that please?
As I explained, unlink is used to delete files. If we have a way to create a file(fopen etc) then we should also have a way to delete files. This is the purpose.
__________________

Last edited by HamletEagle; 05-26-2022 at 14:55.
HamletEagle is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:33.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode