forked from vieter-v/vieter
				
			Doesn't fix anything
							parent
							
								
									9b1e6383e6
								
							
						
					
					
						commit
						af86d91d3f
					
				| 
						 | 
					@ -7,6 +7,7 @@ const pkgs_subpath = 'pkgs'
 | 
				
			||||||
// Handles management of a repository. Package files are stored in '$dir/pkgs'
 | 
					// Handles management of a repository. Package files are stored in '$dir/pkgs'
 | 
				
			||||||
// & moved there if necessary.
 | 
					// & moved there if necessary.
 | 
				
			||||||
pub struct Repo {
 | 
					pub struct Repo {
 | 
				
			||||||
 | 
					mut:
 | 
				
			||||||
	mutex shared int = 0
 | 
						mutex shared int = 0
 | 
				
			||||||
pub:
 | 
					pub:
 | 
				
			||||||
	dir string [required]
 | 
						dir string [required]
 | 
				
			||||||
| 
						 | 
					@ -14,20 +15,20 @@ pub:
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Returns path to the given package, prepended with the repo's path.
 | 
					// Returns path to the given package, prepended with the repo's path.
 | 
				
			||||||
pub fn (r Repo) pkg_path(pkg string) string {
 | 
					pub fn (r &Repo) pkg_path(pkg string) string {
 | 
				
			||||||
	return os.join_path(r.dir, pkgs_subpath, pkg)
 | 
						return os.join_path(r.dir, pkgs_subpath, pkg)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub fn (r Repo) exists(pkg string) bool {
 | 
					pub fn (r &Repo) exists(pkg string) bool {
 | 
				
			||||||
	return os.exists(r.pkg_path(pkg))
 | 
						return os.exists(r.pkg_path(pkg))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Returns the full path to the database file
 | 
					// Returns the full path to the database file
 | 
				
			||||||
pub fn (r Repo) db_path() string {
 | 
					pub fn (r &Repo) db_path() string {
 | 
				
			||||||
	return os.join_path_single(r.dir, '${r.name}.tar.gz')
 | 
						return os.join_path_single(r.dir, '${r.name}.tar.gz')
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub fn (r Repo) add_package(pkg_path string) ? {
 | 
					pub fn (r &Repo) add_package(pkg_path string) ? {
 | 
				
			||||||
	mut res := os.Result{}
 | 
						mut res := os.Result{}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	lock r.mutex {
 | 
						lock r.mutex {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue